您的位置:首页 > Web前端 > Vue.js

vuejs1.x中定义异步组件实例

2017-02-20 10:43 316 查看
官方文档中描述得不是很详细。这里做个笔记。

HTML:

<div id="full">
<home></home>
</div>

JS:

//定义异步组件,主页
Vue.component('home', function(resolve, reject) {
$.ajax({
url: "main.html",
dataType: 'text',
type: "get",
success: function(html) {
resolve({
template: html,
ready: function() {
}
});
}
});
});

var full = new Vue({
el: "#full",
ready: function() {

},
data: {
isLogin: true
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Vue.js JavaScript
相关文章推荐