mpvue中使用vant-weapp


安装

# 通过 npm 安装
npm i vant-weapp -S --production
# 通过 yarn 安装
yarn add vant-weapp --production
# 直接通过 git 下载 Vant Weapp 源代码,并将dist或lib目录拷贝到自己的项目中
git clone https://github.com/youzan/vant-weapp.git

引入

 

// 以下方法使用于git下载安装的方法

// 全局引入 app.json
"window": {
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "WeChat",
    "navigationBarTextStyle": "black"
},
"usingComponents": {
    "van-steps": "/static/vant/steps/index"
}
// 页面引入 main.json
{
    "usingComponents": {
        "van-steps": "/static/vant/steps/index"
    },
}    

 

注意  引入组件后,我们需要重新将项目打包一下(npm run build)

    微信小程序开发工具中的打开es6转es5(不然会报错的)

    全局引入"usingComponents"与window同级(报错:无效的 appJSON["window"]["usingComponents"])

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM