溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

微信小程序使用Vant Weapp組件庫的方法步驟

發(fā)布時(shí)間:2020-09-01 18:39:26 來源:腳本之家 閱讀:174 作者:直男程序員的鋼鐵之路 欄目:web開發(fā)

微信小程序使用Vant Weapp組件庫的方法步驟

地址:https://youzan.github.io/vant/#/zh-CN/intro

一.引入Vant組件庫

1.首先運(yùn)行 npm init

微信小程序使用Vant Weapp組件庫的方法步驟

微信小程序使用Vant Weapp組件庫的方法步驟

就會(huì)生成 package.json

微信小程序使用Vant Weapp組件庫的方法步驟

2.運(yùn)行

npm i vant-weapp -S --production

 微信小程序使用Vant Weapp組件庫的方法步驟

微信小程序使用Vant Weapp組件庫的方法步驟 

3.安裝成功后 點(diǎn)擊 工具 => 構(gòu)建npm

微信小程序使用Vant Weapp組件庫的方法步驟

之后點(diǎn)擊 詳情 => 使用構(gòu)建npm 渲染

微信小程序使用Vant Weapp組件庫的方法步驟

二.使用組件庫

首先在json文件中引入組件

微信小程序使用Vant Weapp組件庫的方法步驟

"van-button": "vant-weapp/button"

之后可以在官網(wǎng)找到想要用的組件使用

微信小程序使用Vant Weapp組件庫的方法步驟 

微信小程序使用Vant Weapp組件庫的方法步驟 

報(bào)錯(cuò)碼

VM292:1 thirdScriptError sdk uncaught third Error module "miniprogram_npm/vant-weapp/mixins/transition" is not defined Error: module "miniprogram_npm/vant-weapp/mixins/transition" is not defined at require (http://127.0.0.1:56368/appservice/__dev__/WAService.js:22:26700) at http://127.0.0.1:56368/appservice/__dev__/WAService.js:22:26448 at http://127.0.0.1:56368/appservice/miniprogram_npm/vant-weapp/popup/index.js:5:19 at require (http://127.0.0.1:56368/appservice/__dev__/WAService.js:22:26841) at <anonymous>:395:7 at HTMLScriptElement.scriptLoaded (http://127.0.0.1:56368/appservice/appservice?t=1557802464868:4544:21) at HTMLScriptElement.script.onload (http://127.0.0.1:56368/appservice/appservice?t=1557802464868:4556:20) 

解決方法:

你只需要把miniprogram_npm/vant-weapp里的組件文件夾都刪除,

之后再https://github.com/youzan/vant-weapp下載一份vant, 將dist文件夾(vant-weapp-dev\vant-weapp-dev\dist)中的文件復(fù)制到項(xiàng)目的miniprogram_npm/vant-weapp

即下載一份vant,之后替換掉項(xiàng)目中的文件

之后保存解決

微信小程序使用Vant Weapp組件庫的方法步驟

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)億速云的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI