Skip to content

v-show 在 mergeVirtualHostAttributes 下失效的问题 #5688

@jacksonyu

Description

@jacksonyu

发行方式

小程序

具体平台

微信小程序最新版

开发环境

macOS

项目创建方式

None

依赖版本

3.0.0-4070520250711001
3.0.0-4060620250520001

问题描述

在开启 mergeVirtualHostAttributes 且组件设置 virtualHost: true 的条件下,v-show 失效。

// 组件 tran.vue
<template>
    <view v-show="show">
        tran comp  = "{{show}}"
    </view>
</template>

<script setup lang="ts">
defineProps<{
    show: boolean
}>()
</script>

<script lang='ts'>
export default { options: { virtualHost: true } }
</script>
// 组件 tran2.vue
<template>
    <Tran :show="show" />
</template>

<script setup lang="ts">
import Tran from './tran.vue'
defineProps<{
    show: boolean
}>()
</script>

<script lang='ts'>
export default { options: { virtualHost: true } }
</script>

在 pages/index/index.vue 中使用:

<template>
  <view class="content">
    <view>tran:</view>
    <Tran :show="false"/>
    <view>Tran2:</view> 
    <Tran2 :show="false"/>
  </view>
</template>

运行 pnpm dev:mp-weixin。
在最新版 3.0.0-4070520250711001 下:
Tran :show="false" 正常显示,v-show 丢失。
Tran2 :show="false" 正常显示,v-show 丢失。
Image

退回上一个版本,在 3.0.0-4060620250520001 下:
使用 Tran :show="false" 正常, Tran 的 v-show 正常,组件未显示。
使用封装了 Tran 的 Tran2 ,v-show 丢失,组件显示。
Image

退回我升级之前的版本:3.0.0-4040520250104002,运行正常:
Image

重现步骤

请看上一步。

期望行为

v-show 正常

实际行为

No response

截图或录屏

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions