当前位置:网站首页>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 ~
边栏推荐
- 深度学习——卷积的滑动窗口实现
- Tue Jun 28 2022 15:30:29 gmt+0800 (China standard time) date formatting
- Full stack performance testing theory - Summary
- TP5 set direct download file
- Given a fixed point and a straight line, find the normal equation of the straight line passing through the point
- Combinatorial mathematics Chapter 1 Notes
- Introduction notes to pytorch deep learning (XII) neural network - nonlinear activation
- Palindrome substring, palindrome subsequence
- November 22, 2021 [reading notes] - bioinformatics and functional genomics (Chapter 5, section 4, hidden Markov model)
- 1163 Dijkstra Sequence
猜你喜欢

Introduction notes to pytorch deep learning (XII) neural network - nonlinear activation
![November 22, 2021 [reading notes] - bioinformatics and functional genomics (Section 5 of Chapter 5 uses a comparison tool similar to blast to quickly search genomic DNA)](/img/de/7ffcc8d6911c499a9798ac9215c63f.jpg)
November 22, 2021 [reading notes] - bioinformatics and functional genomics (Section 5 of Chapter 5 uses a comparison tool similar to blast to quickly search genomic DNA)

Do you know the IP protocol?

6月底了,可以开始做准备了,不然这么赚钱的行业就没你的份了

你了解IP协议吗?
![[flower carving experience] 14 line blank board pingpong library test external sensor module (one)](/img/ba/1d1c5b51cdfc4075920a98d64820c2.jpg)
[flower carving experience] 14 line blank board pingpong library test external sensor module (one)

Deep learning -- recurrent neural network

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

深度学习——使用词嵌入and词嵌入特征

深度学习——残差网络ResNets
随机推荐
Summary and common applications of direction and angle operators in Halcon
AcrelEMS能效管理平台为高层小区用电安全保驾护航
Introduction notes to pytorch deep learning (11) neural network pooling layer
[tensorflow GPU] building of deep learning environment under windows11
期末复习-PHP学习笔记1
Basic theory of four elements and its application
Full stack performance testing theory - Summary
架构实战营模块 5 作业
Investment and financing analysis report of Supply Chain & logistics industry in 2021
Want to ask, how to choose securities companies for stock speculation? Is it safe to open an account online?
Deep learning vocabulary representation
An example of a single service in a cloud project driven by a domain
[flower carving experience] 12 build the Arduino development environment of esp32c3
回文子串、回文子序列
min_ max_ Gray operator understanding
December 13, 2021 [reading notes] | understanding of chain specific database building
你了解IP协议吗?
Combinatorial mathematics Chapter 1 Notes
November 19, 2021 [reading notes] a summary of common problems of sneakemake (Part 2)
Analysis of cross clock transmission in tinyriscv