1.重新安装
npm install uview-ui
2.在项目根目录中的main.js中,引入并使用uView的JS库,注意这两行要放在import Vue之后。
import uView from "uview-ui";
Vue.use(uView);
3.在项目根目录的uni.scss中引入此文件。
@import 'uview-ui/theme.scss';
4.在App.vue引入uView基础样式
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss";
</style>
5.在项目根目录的pages.json中配置easycom组件模式
注意:如果有其他插件,需要将uview-ui设为第一行
{
"easycom": {
"autoscan": true,
"custom": {
// uview-ui
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
// @dcloudio
"^uni-(.*)": "@dcloudio/uniui/lib/uni-$1/uni-$1.vue"
}
},
}
6.配置完成,保存全部,重新试试
本文地址:https://blog.csdn.net/Day71/article/details/109272252
您可能感兴趣的文章:
- vue init初始化项目后 npm run dev报错 10% building modules 1/1 modules 0 activeevents
- axios 处理 302 状态码的解决方法
- [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/feature
- react-native 在新版Xcode(10+)中运行出现的问题: node_modules/react-native/third-party/glog-0.3.4 , C compiler cannot create executables
- 使用puppeteer爬取网站并抓出404无效链接
- 【angular2+typeScript+ng-zorro】Carousel 走马灯的左右方向控件实现
- Cannot read property 'tap' of undefined
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论