摘要: vue中如果父组件想调用子组件的方法,可以在子组件中加上ref,然后通过this.$refs.ref.method调用,例如: 父组件: <template> <div @click="fatherMethod"> <child ref="child"></child> </div> </templ 阅读全文
posted @ 2020-03-28 08:19 kitterKing 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 第一种方法是直接在子组件中通过this.$parent.event来调用父组件的方法 父组件 <template> <div> <child></child> </div> </template> <script> import child from '~/components/dam/child' 阅读全文
posted @ 2020-03-28 08:18 kitterKing 阅读(12291) 评论(0) 推荐(1) 编辑