We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H5
浏览器版本: Google Chrome 86.0.4240.183 使用框架: Vue 2
1.创建scss变量管理文件 src/assets/style/variable.scss 2.在文件中写入 $color-body-bg: #F6F6F6; 3.在config/index.js添加配置 config: { ... sass: { resource: path.resolve(__dirname, '..', 'src/assets/style/variable.scss'), }, ... } 4.启动项目 5.在src/app.scss中使用scss变量 .layout-main { background-color: $color-msg-bg; } 6.控制台将会报错 SassError: Undefined variable. ╷ 4 │ background-color: $color-body-bg; │ ^^^^^^^^^^^^^
正常使用全局scss变量
编译报错
Taro CLI 3.0.16 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.4.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.7 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.0.16 => 3.0.16 @tarojs/components: 3.0.16 => 3.0.16 @tarojs/mini-runner: 3.0.16 => 3.0.16 @tarojs/runtime: 3.0.16 => 3.0.16 @tarojs/taro: 3.0.16 => 3.0.16 @tarojs/webpack-runner: 3.0.16 => 3.0.16 babel-preset-taro: 3.0.16 => 3.0.16 eslint-config-taro: 3.0.16 => 3.0.16
The text was updated successfully, but these errors were encountered:
该问题是否有解决方案?
Sorry, something went wrong.
ZEJIA-LIU
No branches or pull requests
相关平台
H5
浏览器版本: Google Chrome 86.0.4240.183
使用框架: Vue 2
复现步骤
1.创建scss变量管理文件
src/assets/style/variable.scss
2.在文件中写入
$color-body-bg: #F6F6F6;
3.在config/index.js添加配置
config: {
...
sass: {
resource: path.resolve(__dirname, '..', 'src/assets/style/variable.scss'),
},
...
}
4.启动项目
5.在src/app.scss中使用scss变量
.layout-main {
background-color: $color-msg-bg;
}
6.控制台将会报错
SassError: Undefined variable.
╷
4 │ background-color: $color-body-bg;
│ ^^^^^^^^^^^^^
期望结果
正常使用全局scss变量
实际结果
编译报错
环境信息
The text was updated successfully, but these errors were encountered: