vue中子组件如何调用父组件的方法
Opened this issue · 0 comments
hszy00232 commented
方法1: 用prop父:
<comp :method="method"></comp>
{
methods: {
method: function(){
....
}
}
}
子:
<div @click="click">点击</div>
{
props: ['method'],
methods: {
click: function(){
this.method()
}
}
}
方法2: 参考官方 http://cn.vuejs.org/api/#vm-dispatch