+
95
-

回答


1.在父组件中引入子组件

<template>

<view>
<pop ref="pop" @regodate="regodate"></pop>
//ref 调用时用于标识使用 ; @regodate ,调用子组件方法携带参数使用
</view>
</template>

<script>
//引入子组件
import pop from '@/components/pop-up/pop.vue'
export default {
components: {
customSwiper,
tabbar,
pop
},
}
</script>


2.调用子组件的数据和方法
var message = this.$refs.pop.isPopDate = 7 //把子组件中的isPopDate的值改为7
this.$refs.pop.test()//调用子组件method中的test方法


网友回复

我知道答案,我要回答