千古前端图文教程
返回
0
Vue开发积累
Vue 开发积累
001:scoped 关键字的作用
在 xx.vue 组件中,我们可能会遇到带 scoped 关键字的样式。比如:
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
上方的scoped表示的是作用域化,样式只对当前子组件生效。
共 268 篇
千古前端图文教程
/
Vue开发积累
0 字
0 行
cosolar
创建
2026-11-08T09:55:11.325138865Z
更新
2026-11-08T09:57:40.829819554Z