Zsan
Zsan
  • 发布:2021-11-22 14:47
  • 更新:2022-01-19 18:29
  • 阅读:1575

#插件讨论# 【 uni-ui - DCloud前端团队 】使用uni-scss辅助样式库,项目启动报错

分类:uni-app
关联插件: uni-ui

按文档在 vue-cli 项目中使用 npm 安装 uni-ui 库,
使用uni-scss辅助样式库,项目启动报错
在 App.vue <style lang='scss'> 中引入@import '@dcloudio/uni-ui/lib/uni-scss';

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.  

Recommendation: math.div($uni-radius-root, 2)  

More info and automated migrator: https://sass-lang.com/d/slash-div  

   ╷  
11 │     'sm': $uni-radius-root / 2,  
   │           ^^^^^^^^^^^^^^^^^^^^  
   ╵  
    node_modules/@dcloudio/uni-ui/lib/uni-scss/styles/setting/_variables.scss 11:11  @import  
    node_modules/@dcloudio/uni-ui/lib/uni-scss/styles/index.scss 1:9                 @import  
    node_modules/@dcloudio/uni-ui/lib/uni-scss/index.scss 1:9                        @import  
    src/App.vue 19:9                                                                 root stylesheet  

Warning: You probably don't mean to use the color value black in interpolation here.  
It may end up represented as black, which will likely produce invalid CSS.  
Always quote color names when using them as strings or map keys (for example, "black").  
If you really want to use the color value here, use '"" + $key'.  

   ╷  
48 │     .uni-#{$key} {  
   │            ^^^^  
   ╵  
    node_modules/@dcloudio/uni-ui/lib/uni-scss/styles/setting/_color.scss 48:9  @import  
    node_modules/@dcloudio/uni-ui/lib/uni-scss/styles/index.scss 3:9            @import  
    node_modules/@dcloudio/uni-ui/lib/uni-scss/index.scss 1:9                   @import  
    src/App.vue 19:9 
2021-11-22 14:47 负责人:无 分享
已邀请:
Zsan

Zsan (作者)

node-sass与drat-sass兼容问题

需要把uni-scss/styles/setting/_variables.scss 11行
$uni-radius-root / 2 改成 $uni-radius-root * 0.5

uni-scss/styles/setting/_color.scss 中

$uni-ui-color:(  
  primary: $uni-primary,  
  primary-disable: $uni-primary-disable,  
  ...  
)

key值改为字符串 'primary': $uni-primary

  • thinkphp爱好者

    请问在哪个位置修改啊,没找到这个地方

    2022-04-13 11:04

DCloud_UNI_HT

DCloud_UNI_HT

更新 uni-scss 即可 ,该问题已经修复

  • 1***@qq.com

    node16.13.0对应的是sass6和sass-loader11,安装uni-ui报错的原因需要低版本的洒洒水,但是node16不支持,请问怎么办

    2022-04-10 19:10

  • thinkphp爱好者

    请问在哪个位置修改啊,没找到这个地方

    2022-04-13 11:04

该问题目前已经被锁定, 无法添加新回复