父组件:
<template>
<view class="content">
<aaaaa>
<template v-slot:default>
<view class="b">111111111</view>
</template>
</aaaaa>
</view>
</template>
<script>
import aaaaa from './aaaaa.vue'
export default {
components: {
aaaaa,
},
data() {
return { }
},
onLoad() {
},
methods: {
console() {
console.log(1111111111111);
},
},
}
</script>
<style></style>
子组件:
<template>
<view class="aaaaaa">
<slot name="default"></slot>
</view>
</template>
<script>
export default {
options: {
styleIsolation: 'shared',
virtualHost: true,
},
externalClasses: ['class'],
data() {
return { }
},
mounted() {
this.$parent.console(); //微信小程序调用成功,H5报this.$parent.console is not a function
this.$parent.$parent.console(); //H5调用成功
},
methods: { },
}
</script>
<style></style>
1***@qq.com (作者)
子组件:
问题还是存在的
2024-01-04 16:54