javascript - How could Vue.js have templateUrl configure just like Angular.js do? -


i love simplicity of vue.js, don't want complexify browserify or webpack. prefer templateurl in angular, can serve partial page(usually component) nginx directly. how set this? it's not suggested officially, hard there.

vue doesn't have built in far can tell you'd able use async components fake if wanted to.

vue.component('example', function (resolve, reject) {   $.get('templates/example.html').done(function (template) {     resolve({       template: template     })   }); }); 

you'd able in html.

<div id="app"></div>  <template id="example">   <div>     <h1>{{ message }}</h1>   </div> </template> 

then can like:

new vue({   el: '#app',   components: {     example: {       template: '#example',       data: function () {         return {           message: 'yo'         }       }     }   } }); 

though, think taking time comfortable browserify or webpack worth investment. because can use vueify.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -