喜欢下雨闻到的泥土味,喜欢下雨带来的丝丝凉意,喜欢窝在被窝听着窗外啪嗒啪嗒的声音,喜欢被雨冲刷以后的这个世界

在CSS变量中使用SCSS变量无效
在CSS变量中使用SCSS变量无效
<template>
  <!-- Your template -->
</template>

<script>
  export default {
    layout: 'blog'
    // page component definitions
  }
</script>

在SCSS中定义了一个变量,但是在CSS中使用SCSS中定义的变量无效:

$color: #f00;

:root {
  --text-color: $color; /** 无效 */
}

使用#{}Interpolation插值来解决此问题:

$color: #f00;

:root {
  --text-color: #{$color};
}

参考文档:https://sass-lang.com/documentation/interpolation