【发布时间】:2019-12-10 20:15:13
【问题描述】:
我是 scss 的新手,所以我想知道是否可以使用组件的 Typescript 更改 scss 变量。
所以考虑一下:
html:
<div (someEvent)="handleEvent($event)"></div>
scss:
$thememode: 'theme1';
$textcolormode: 'nonHover';
$colorOpacity: 0.1;
@mixin someFunction(param1, param2){
//do scss magic
}
ts: //Here is what I want to do, but dont know to code:
handleEvent(event):void{
this.scssFile.$thememode = 'theme2';
this.scssFile.$colormode = 'hover';
this.scssFile.$colorOpacity = this.someattribute + this.someServive.$generateAnotherValue(someParam);
this.scssFile.@someFunction(23, 'mode1');
}
基本上我只是希望能够访问我定义的 scss 变量/mixin。
有没有办法做到这一点?
【问题讨论】:
-
只使用 CSS 变量。
标签: angular sass scss-mixins