当前位置:   article > 正文

如何在项目中使用uni-ui组件库_uni-ui使用

uni-ui使用

1、安装uni-ui

npm i @dcloudio/uni-ui

2、组件自动引用

配置easycom

使用 npm 安装好 uni-ui 之后,需要配置 easycom 规则,让 npm 安装的组件支持 easycom

打开项目根目录下的 pages.json 并添加 easycom 节点:

  1. // pages.json
  2. {
  3. "easycom": {
  4. "autoscan": true,
  5. "custom": {
  6. // uni-ui 规则如下配置
  7. "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
  8. }
  9. },
  10. // 其他内容
  11. pages:[
  12. // ...
  13. ]
  14. }

3、配置ts类型

npm i -D @uni-helper/uni-ui-types

tsconfig.json中配置

  1. "types": [
  2. "@dcloudio/types",
  3. "miniprogram-api-typings",
  4. "@uni-helper/uni-app-types",
  5. "@uni-helper/uni-ui-types"
  6. ]

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/868968
推荐阅读
相关标签
  

闽ICP备14008679号