当前位置:网站首页>Wechat applet reports errors using vant web app
Wechat applet reports errors using vant web app
2022-06-30 08:02:00 【Dark_ programmer】
Wechat applet use vant weapp Report errors
If according to 【vant weapp】 Step by step , Maybe you will encounter the mistakes I encountered .
My step hole , I hope I can help you solve the problem .
A wrong : Build error

When according to vant weapp A quick guide to getting started step by step , here we are Step four structure npm package Encountered the first pit .
This error is actually caused by the configuration in the previous step packNpmRelationList When the path is not accurate .
terms of settlement :
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./node_modules/"
}
]
In this way Building a successful 
Error 2 :[“usingComponents”][“van-button”] Not found

This is the second pit encountered , This pit is a bit confusing . Obviously In full compliance with official documentation To the , Why? There will be problems ? Not believing in evil, I created threeorfour small programs again and again , Go through this process again . Without exception , It's all about this .
Baidu for a long time ,google Long time . Read a lot of related articles , I found that there was a Common ground :
npm Build build build miniprogram_npm
But I looked at my little program carefully , determine There is no such document . Why do others have , I didn't ??? Is there something wrong ??? Or say Process reversal 了 ???
Think of this , Get ready Reference resources Official documents , Then adjust the process properly . Sure enough , succeed .
Here are the steps for my successful installation and use .
My installation process
1. Recreate project
There is no need to repeat the step of creating a project 
At this time Directory structure :
2. initialization npm
If you have installed node and npm.
npm init -y

3. Installing a plug-in
npm i @vant/weapp -S --production

4. Check npm & npm structure

Be careful :
If there is Use npm Module options , it Check , then structure npm
If There is no need to tangle , direct structure npm
I don't have any here Use npm Module options This option
After building , Note that there is one more folder in the directory structure of the project :
In this , We have a folder that others have .
5. modify project.config.json
{
...
"setting": {
...
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./miniprogram/"
}
]
}
}
6. Import components
If an error is found Error: module "miniprogram_npm/@vant/weapp/common/component.js" is not defined, Take it easy , Just refresh it .
You can Choice in app.json introduce , It can also be in Specify the json file Introduce in
I was in app.json In the introduction :
"usingComponents": {
"van-button": "@vant/weapp/button/index"
}

7. Use components
<van-button type="default"> Default button </van-button>
<van-button type="primary"> Main buttons </van-button>
<van-button type="info"> Information buttons </van-button>
<van-button type="warning"> Warning button </van-button>
<van-button type="danger"> Danger button </van-button>

8. “style”: “v2”
stay vant weapp Official documents give such a sentence :
take app.json Medium
"style": "v2"Remove , AppletNew basic componentsA lot of styles have been added , It's hard to cover , Do not close will cause some component style confusion .
So it depends on your personal situation , Do you want to delete this sentence ~
边栏推荐
- 期末复习-PHP学习笔记5-PHP数组
- 6月底了,可以开始做准备了,不然这么赚钱的行业就没你的份了
- Final review -php learning notes 1
- Introduction to opencv (II): image color space conversion and image saving
- 深度学习——语言模型和序列生成
- 1163 Dijkstra Sequence
- Full stack performance testing theory - Summary
- Simple application of generating function -- integer splitting 2
- 直击产业落地 | 飞桨重磅推出业界首个模型选型工具
- 【笔记】Polygon mesh processing 学习笔记(10)
猜你喜欢
![2021-10-29 [microbiology] a complete set of 16s/its analysis process based on qiime2 tool (Part I)](/img/9d/37c531b1b439770f69f715687685f5.jpg)
2021-10-29 [microbiology] a complete set of 16s/its analysis process based on qiime2 tool (Part I)

Hit the industry directly | the flying propeller launched the industry's first model selection tool

期末复习-PHP学习笔记5-PHP数组

你了解IP协议吗?
![2021-10-29 [microbiology] qiime2 sample pretreatment form automation script](/img/4d/3a3d645a27c3561c3ebe20dcd8e142.jpg)
2021-10-29 [microbiology] qiime2 sample pretreatment form automation script

Efga design open source framework openlane series (I) development environment construction
![[flower carving experience] 13 build the platformio ide development environment of esp32c3](/img/32/2c30afe77bf82774479a671ff16898.jpg)
[flower carving experience] 13 build the platformio ide development environment of esp32c3

Construction of energy conservation supervision system for campus buildings of ankery University

跳槽字节跳动很难嘛?掌握这些技巧,你也能轻松通过

深度学习——Bounding Box预测
随机推荐
期末复习-PHP学习笔记4-PHP自定义函数
[notes] polygon mesh processing learning notes (10)
mysql无法连接内网的数据库
深度学习——嵌入矩阵and学习词嵌入andWord2Vec
Go 数据类型篇之字符串及底层字符类型
Vulfocus entry target
Summary and common applications of direction and angle operators in Halcon
Final review -php learning notes 1
Final review -php learning notes 2-php language foundation
深度学习——语言模型和序列生成
奇迹MU服务器租用选择 真实好用 稳定不卡 还能防入侵
Recurrence relation (difference equation) -- Hanoi problem
Tue Jun 28 2022 15:30:29 gmt+0800 (China standard time) date formatting
ACM. HJ48 从单向链表中删除指定值的节点 ●●
AcrelEMS能效管理平台为高层小区用电安全保驾护航
2021-10-27 [WGS] pacbio third generation methylation modification process
Go 数据类型篇之基本数据类型之间的转化
C. Fishingprince Plays With Array
【Tensorflow-gpu】window11下深度学习环境搭建
牛客小白月赛52