Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

包含依赖关系的多个 Vue 文件之间的 样式覆盖问题 #13064

Closed
KikoRepub opened this issue Mar 18, 2025 · 1 comment
Closed

包含依赖关系的多个 Vue 文件之间的 样式覆盖问题 #13064

KikoRepub opened this issue Mar 18, 2025 · 1 comment

Comments

@KikoRepub
Copy link

Vue version

3.2.13

Link to minimal reproduction

I don't know what this should input

Steps to reproduce

A.vue 部分代码:
{

<h3>单文件组件</h3>
<!-- 引入 LifeCycle  -->
<life-cycle :title="666"/>

     import LifeCycle from './lifeCycle.vue';
    components:{
        LifeCycle,
   }

<style scoped>
    h3 {
       background-color: pink;
    }
</style>

}

LifeCycle.vue 代码:

    <h3>6666</h3>
    <h3>{{ title }}</h3>

    name:"LifeCycle",
     props:{
        title:{
            type:String,
            default:""
        }

<style >
    h3{
        background-color: green;
    }
</style>

What is expected?

标签的样式 会被覆盖 或者 非常规形式呈现

What is actually happening?

在项目运行后,对 lifeCycle.vue 中的 两个 H3 分别进行注释,剩余的那一个采用的样式 会很奇怪

具体如下:

  • 如果 两个都 不注释 ==> 两个 H3 背景均为 绿色
  • 如果先注释 6666 ,title 对应的 H3 背景为 粉色 ,此时放开 注释,两个都变为绿色
  • 如果 注释 title , 6666 对应的 H3 背景为 粉色,此时放开注释,两个都变为绿色

System Info

Any additional comments?

使用 props 接收数据 进行相关测试 的时候发现的

貌似是,如果是 只有 一个 H3 ,就会出现 上面的变成粉色的情况,两个 H3 或者 3个以上 就不会。

@jh-leong
Copy link
Member

jh-leong commented Mar 18, 2025

Please follow the issue guidelines and provide a minimal reproduction (e.g., a Playground link or a GitHub repo) to help us investigate further. Thanks!

@jh-leong jh-leong closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants