标签:style 现在 vue div handle ref log port efault
<template> <div> 我是子组件 </div> </template> <script> export default { name: "child", methods: { parentHandleclick(e) { console.log(e) } } </script>
<template>
<div>
<button @click="clickParent">点击我促发子组件方法</button>
<child ref="mychild"></child>
</div>
</template>
<script>
import Child from ‘./child‘;
export default {
name: "parent",
components: {
child: Child
},
methods: {
clickParent() {
this.$refs.mychild.parentHandleclick("父组件调用子组件方法");
}
}
}
</script>
标签:style 现在 vue div handle ref log port efault
原文地址:https://www.cnblogs.com/baller/p/13390393.html