//scope:让样式在局部生效,防止冲突
<template>
<div class="stu">
<h2>学生姓名:{{ name }}</h2>
<h2>学生性别:{{ sex }}</h2>
</div>
</template>
<script>
export default {
name: "Student",
data() {
return {
name: "卢航我儿",
sex: "男",
};
},
};
</script>
<style scope>
.stu {
background-color: orange;
}
</style>
<style lang="css">//lang用于指定style所用的语言css/less
</style>
scope样式
- 本文链接: http://lzkpersonal.com.cn/2023/06/26/1-scope样式/
- 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!