子组件
<template>
<view>
<button @click="sendValue">点击发送值</button>
</view>
</template>
<script>
export default {
data() {
return {
zhi:'子的值'
}
},onLoad() {
},watch: {
},methods: {
sendValue() {
this.$emit('myevent',this.zhi);
}
},}
</script>
<style>
</style>
父组件
<template>
<TC-WXlogin @myevent="handleEvent" />
</template>
<script>
import TCWXlogin from '/uni_modules/TC-WXlogin/pages/index.vue';
export default {
components:{
TCWXlogin
},data() {
return {
}
},methods: {
handleEvent(value) {
console.log(value); // 输出子的值
}
}
}
</script>
<style>
</style>