HBuilder X中uniapp使用Vant Weapp、uView UI
生活随笔
收集整理的這篇文章主要介紹了
HBuilder X中uniapp使用Vant Weapp、uView UI
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1、使用Vant Weapp
安裝: npm init -y npm i @vant/weapp@1.3.3 -S --production在項(xiàng)目目錄中新建目錄wxcomponents,把node_modules中的**@vant里面的dist文件復(fù)制到wxcomponents目錄**中,把dist名稱(chēng)修改為vant(自定義)
在pages.json中
全局引用:
"globalStyle": {"navigationBarTextStyle": "white","navigationBarTitleText": "","navigationBarBackgroundColor": "#C00000","backgroundColor": "#FFFFFF","usingComponents": {"van-card": "/wxcomponents/vant/card/index"}},局部引用:(主包、分包)
{"path": "pages/my/my","style": {"enablePullDownRefresh": false,"usingComponents": {"van-card": "/wxcomponents/vant/card/index"}}}2、使用uView
uView依賴(lài)SCSS,您必須要安裝此插件,否則無(wú)法正常運(yùn)行。
參考文檔有全部步驟:http://v1.uviewui.com/components/intro.html
安裝
配置
// main.js import uView from "uview-ui"; Vue.use(uView);在項(xiàng)目根目錄的uni.scss中引入此文件。
/* uni.scss */ @import 'uview-ui/theme.scss';在APP.vue中:注意要寫(xiě)在第一行
<style lang="scss">/* 注意要寫(xiě)在第一行,同時(shí)給style標(biāo)簽加入lang="scss"屬性 */@import "uview-ui/index.scss"; </style>在pages.json中:配置easycom組件模式
{"easycom": {"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"},// 此為本身已有的內(nèi)容"pages": [// ......] }總結(jié)
以上是生活随笔為你收集整理的HBuilder X中uniapp使用Vant Weapp、uView UI的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Microsoft Media Foun
- 下一篇: 实现-魔方照片墙