开发情况下需要引入vue.js和vue-resource.js,el:dom生效范围,data,dom静态数据,mounted:初始化调用方法,注意,官方文档需要添加this.$nextTict(function(){...}),确保初始化能获取到元素。methods:自定义方法。到页面引用该js,在对应的div中写入{{title}}引用变量即可。

new Vue({
el:"#app",
data:{
title:"Hello Vue"
},filters:{

},mounted: function(){
this.$nextTick(function(){
this.cartView();
})
},methods:{
cartView:function(){
this.title="Vue Hello"
}
}
})
posted on 2017-12-19 19:16  一个大洋葱  阅读(160)  评论(0编辑  收藏  举报