Vue SCSS lighten()

时间:2018-10-22 17:18:42

标签: vue.js sass visual-studio-code vuejs2 node-sass

如何在VueJS中使用诸如lighten( );之类的SASS颜色功能?确切的代码如下:

<style lang="scss">
@import "../assets/variables";

.disable-primary {
  lighten( $primary, 10% );
}
</style>

但是我在VS Code中遇到编译错误:

Failed to compile.
./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue- 
loader/lib/style-compiler?{"vue":true,"id":"data-v- 
8dc7cce2","scoped":false,"hasInlineConfig":false}!./node_modules/sass- 
loader/lib/loader.js?{"sourceMap":true}!./node_modules/vue- 
loader/lib/selector.js?type=styles&index=1!./src/components/Home.vue
Module build failed: 
lighten( $color-primary, 10% );
^
  Property "lighten" must be followed by a ':'

1 个答案:

答案 0 :(得分:5)

函数lighten仅返回一种颜色,您仍然必须将其分配给接受颜色字符串的CSS属性,例如:

.disable-primary {
    background-color: lighten( $primary, 10% );
}

或您要设置的任何属性。