ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

Tooltip或Popover组件子元素data-v标签丢失

Open LiuZheAb opened this issue 1 year ago • 3 comments
trafficstars

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.2.20

Environment

Vue 3.2.47

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Tooltip或Popover组件子元素初始化时v-if="false",后续异步置为true,会导致子元素丢失v-data标签,进而使scoped样式不生效

<script setup>
import { Popover, Tooltip } from "ant-design-vue";
import "ant-design-vue/dist/antd.css";
import { ref } from "vue";

const show = ref(false);
setTimeout(() => {
show.value = true;
}, 200);
</script>

<template>
<Tooltip title="title">
<span class="red" v-if="show">tooltip-hover</span>
</Tooltip>
<br />
<Popover>
<template #content> content </template>
<span class="red" v-if="show">popover-hover</span>
</Popover>
</template>

<style scoped>
.red {
color: red;
}
</style>

What is expected?

子元素携带v-data标签,scoped样式生效

What is actually happening?

子元素丢失v-data标签,scoped样式未生效

LiuZheAb avatar Jun 03 '24 08:06 LiuZheAb

试了下 v-show 可以解决这个问题

selicens avatar Jun 04 '24 02:06 selicens

试了下 v-show 可以解决这个问题

是的,或是把v-if挂在Tooltip / Popover这一层也可以(目前业务代码用的这个方式)。这里只是想把case暴露出来

LiuZheAb avatar Jun 04 '24 02:06 LiuZheAb

v4仍旧存在这个,需要验证一下是否是Vue Teleport的特性

selicens avatar Jun 04 '24 02:06 selicens

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Aug 04 '24 02:08 github-actions[bot]