vue中,点击子组件之后,为什么获取不到父组件方法?
点击子组件之后,为什么获取不到父组件方法?
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.common.dev.js"></script>
</head>
<body>
<div id="app">
<table>
<tbody>
<div is="row"></div>
<div is="row"></div>
<div is="row"></div>
</tbody>
</table>
</div>
<script type="text/javascript">
Vue.component('row',{
data:function(){
return {
content:"this is a content",
}
},
methods:{
handleClick:function(){
this.$emit("handleChange")
}
},
template:'<tr [@click](/user/click)="handleClick"><td> {{content}}</td></tr>'
})
var app=new Vue({
el:"#app",
data:{
},
methods:{
handleChange:function(){
console.log("hello")
}
}
})
</script>
</body>
</html>