vue 2.0 需注意事项
2017-01-09 11:06
155 查看
1、 template标签只能存在一个根节点(否则只渲染第一个根节点)
2、$on 和 $emit 用法:
<div>
<!-- 监听事件 -->
<modal-dialog v-on:close="change"></modal-dialog>
</div>
Vue.component('modal-dialog',{
template:' <button @click="close">Close</button>',
data:function(){},
methods:{
close:function(){
// 触发事件
this.$emit('close');
}
}
})
new Vue({
el:'',
data:{},
methods:{
change:function(){ }
}
})
2、$on 和 $emit 用法:
<div>
<!-- 监听事件 -->
<modal-dialog v-on:close="change"></modal-dialog>
</div>
Vue.component('modal-dialog',{
template:' <button @click="close">Close</button>',
data:function(){},
methods:{
close:function(){
// 触发事件
this.$emit('close');
}
}
})
new Vue({
el:'',
data:{},
methods:{
change:function(){ }
}
})
相关文章推荐
- Vue2.0入门实例注意事项
- elasticSearch 2.0搭建集群注意事项
- 在Windows Vista安装.NET 2.0开发环境注意事项
- aspnetforums2.0 Beta版安装注意事项
- liferay中整合vue--打包注意事项
- Vue.js中用v-bind绑定class的注意事项
- 在.NET 2.0框架下动态创建Access数据库和表时的注意事项
- vue 安装以及注意事项
- vue中使用better-scroll做横向滚动注意事项
- 开发Web 2.0的9条注意事项 清晰的目标是核心
- 在Windows Vista安装.NET 2.0开发环境注意事项
- net 2.0 访问Oracle --与Sql Server的差异,注意事项,常见异常
- Vue.set() this.$set()引发的视图更新思考及注意事项
- .net 2.0 访问Oracle --与Sql Server的差异,注意事项,常见异常
- Selenium WebDriver 2.0 升级到3.0 需要注意的事项 (2)
- asp.net 2.0 Profile 的一些注意事项(序列化)
- 在Windows Vista安装.NET 2.0开发环境注意事项
- .net 2.0 访问Oracle --与Sql Server的差异,注意事项,常见异常
- vue.js使用注意事项
- .net 2.0 访问Oracle --与Sql Server的差异,注意事项,常见异常