- 发布:2024-03-08 13:26
- 更新:2024-03-08 17:35
- 阅读:169
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 14.3.1 (23D60)
HBuilderX类型: 正式
HBuilderX版本号: 3.99
手机系统: 全部
手机厂商: 华为
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
示例代码:
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="">
<slot-bug>
<template #right>
<view>xxx</view>
</template>
</slot-bug>
</view>
</view>
</template>
<template>
<view>
<text>slot-bug</text>
<view class="">
<slot name="right"></slot>
</view>
<view class="">
{{ Boolean($slots.right) }}
</view>
</view>
</template>
<script>
export default {
name: "solt-bug",
created() {
console.log(Object.keys(this.$slots));
},
}
</script>
<style>
</style>
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="">
<slot-bug>
<template #right>
<view>xxx</view>
</template>
</slot-bug>
</view>
</view>
</template>
<template>
<view>
<text>slot-bug</text>
<view class="">
<slot name="right"></slot>
</view>
<view class="">
{{ Boolean($slots.right) }}
</view>
</view>
</template>
<script>
export default {
name: "solt-bug",
created() {
console.log(Object.keys(this.$slots));
},
}
</script>
<style>
</style>
操作步骤:
运行 APP 即可见
运行 APP 即可见
预期结果:
预期:Boolean($slots.right) is true
预期:Boolean($slots.right) is true
实际结果:
实际:Boolean($slots.right) is false
实际:Boolean($slots.right) is false
bug描述:
$slots.xxx 在 app vue 下不生效,slots.xxx 如果获取到相应的 slot