详细问题描述
[内容]
子组件 内容
<template>
<view class="content">
<view>
<button size="mini" @tap="show()">子组件按钮</button>
</view>
<view class="header">
<slot></slot>
</view>
</view>
</template>
<script>
export default {
data() {
return {
msg: "子组件"
}
},
methods: {
show() {
console.log("子组件事件");
}
}
}
</script>
父组件 内容
<template>
<view class="content">
<text class="title"></text>
<test>
<button size="mini" @tap="abc()">父组件按钮</button>
</test>
</view>
</template>
<script>
import test from "../../components/testcom.vue"
export default {
components: {
test
},
data: {
title: '父组件'
},
methods: {
abc() {
console.log("父组件事件");
}
}
}
</script>
重现步骤
[步骤]
点击 父组件按钮 同时触发了 子组件按钮的tap和父组件按的tap,同样点击 子组件按钮 也同时触发了 子组件按钮的tap和父组件按的tap
[结果]
[期望]
运行环境
[系统版本]
[浏览器版本]
[IDE版本] HBuilderX 0.1.50.20180918-alpha
[手机操作系统] 小程序开发者工具
[手机型号]
[mui版本]
附件
[代码片段]
[安装包]
联系方式
[QQ]
[电话]