1.定义方式
在src静态资源里新建.styl文件 如:src/assets/styles/varibles.styl
内容如下:// 定义变量 $bgColor = #b3d4db;2.使用方式
<style lang="stylus" scoped>
@import '~@styles/varibles.styl';// 引入
.container {
background-color: $bgColor; // 使用
}
</style>
扩展知识
如何在css样式中引入外部样式
答:@import 'url' ,注意import前需要加@符号 @符号 @符号