在同一个vue文件里里同时加入style即可跟普通html页面差不多,可以写多个style。想要设置局部样式就加scoped,设置全局样式就不加scoped
<style lang="scss">
html,
body,
#app {
height: 100%;
}
</style>
<style lang="scss" scoped>
h1 {
text-align: center;
font-size: px2rem(36);
height: px2rem(148);
padding: px2rem(148-36-44) 0 px2rem(44) 0;
line-height: px2rem(36);
color: #fff;
}
.login {
background-color: #2ade69;
height: 100%;
}
</style>
加scoped之后vue会自动给dom加上data-v-xxxx属性用来确定局部范围。
// 加scoped之后
<h1 data-v-234234234>登录</h1>
网友评论