使用 scoped 后,父组件的样式将不会渗透到子组件中。
<template lang="html">
<div class="header-search">
<Input class="header__search"/>
</div>
</template>
<style lang="scss" scoped>
.header-search{
& /deep/ .ivu-input {
height: 36px;
font-size: 14px;
}
}
</style>
本文介绍如何使用scoped属性实现Vue组件内的样式隔离,防止父组件样式影响子组件,通过具体代码示例展示了如何针对特定组件应用样式。
2739

被折叠的 条评论
为什么被折叠?



