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

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -