我在我的nuxt网页上添加了v-翻转。所以我的模板是这样的:
<div class="about__cards">
<vue-flip class="about__single-card" active-click width = "350px" height="450px">
<template v-slot:front>
<p class="about__title">Stacks</p>
</template>
<template v-slot:back>
<h4>My stacks</h4>
<ul>
<li>Javascript</li>
<li>Css</li>
<li>HTML</li>
<li>Vue</li>
<li>Nuxt</li>
</ul>
</template>
</vue-flip>
...这是我的造型:
.about__cards{
display:flex;
justify-content: space-evenly;
/* background-color: transparent; */
}
.about__single-card{
border:1px red solid;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 5px 18px rgba(0, 0, 0, 0.6);
cursor: pointer;
transition: 0.5s;
position: relative;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;
}
.front{
background: red;
width: 100%;
height: 100%;
/* line-height: 448px; */
text-align: center;
vertical-align: middle;
/* display: flex;
flex-direction: column;
align-content: flex-end; */
}我把它放在前面,因为当我检查元素时,我看到的是那个类。一切似乎都在起作用。然后我意识到我还没有确定样式的范围,其他页面也是如此。我做了,重新启动服务器,现在它不再工作--v-槽的样式。但是如果我去检查元素,然后我去到预先给定的"front"类,我可以在那里修改它.我读到你可以用v-插槽,但在我做之前,我有点困惑。我在这里错过了什么?谢谢
发布于 2020-06-05 10:57:03
这是因为作用域样式是通过使用组件唯一id作为选择器的一部分来“限定范围”的。
如果你检查你的应用程序,你会看到这样的东西(1d328d7a是uid)
<div
data-v-1d328d7a=""
class="field-input-wrapper"
....field-input-wrapper[data-v-1d328d7a] {
...为了绕过这个问题,您可以像这样使用深选择器
.about__single-card >>> .front{
background: red;
width: 100%;
height: 100%;
text-align: center;
vertical-align: middle;
}https://stackoverflow.com/questions/62212676
复制相似问题