当前位置:网站首页>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 components
A 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 ~
边栏推荐
- Deep learning -- sequence model and mathematical symbols
- 想转行,却又不知道干什么?此文写给正在迷茫的你
- ACM. HJ48 从单向链表中删除指定值的节点 ●●
- String and underlying character types of go data type
- Halcon12+vs2013 C # configuration
- At the age of 25, I started to work in the Tiankeng industry with buckets. After going through a lot of hardships to become a programmer, my spring finally came
- December 4, 2021 [metagenome] - sorting out the progress of metagenome process construction
- 全栈最全性能测试理论-总结
- Go 数据类型篇之字符串及底层字符类型
- 领域驱动下cloud项目中单个服务的示例
猜你喜欢
Development technology sharing of Jingtan NFT digital collection system
Efga design open source framework fabulous series (I) establishment of development environment
期末复习-PHP学习笔记4-PHP自定义函数
Do you know the IP protocol?
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)
深度学习——语言模型和序列生成
【JUC系列】Fork/Join框架之概览
What management improvements can CRM bring to enterprises
November 19, 2021 [reading notes] a summary of common problems of sneakemake (Part 2)
February 14, 2022 [reading notes] - life science based on deep learning Chapter 2 Introduction to deep learning (Part 1)
随机推荐
【笔记】Polygon mesh processing 学习笔记(10)
Is it difficult to jump job ByteDance? With these skills, you can easily pass
Deep learning - goal orientation
Hit the industry directly | the flying propeller launched the industry's first model selection tool
Lexicographic order -- full arrangement in bell sound
Final review -php learning notes 4-php custom functions
微信小程序使用vant weapp报错
Self study notes -- use of 74h573
Summary and common applications of direction and angle operators in Halcon
期末复习-PHP学习笔记4-PHP自定义函数
CRM&PM如何帮助企业创造最优销售绩效
At the age of 25, I started to work in the Tiankeng industry with buckets. After going through a lot of hardships to become a programmer, my spring finally came
How to handle the expired data of redis and what are the elimination mechanisms?
Go 数据类型篇之基本数据类型之间的转化
深度学习——BRNN和DRNN
Opencv4.2.0+vs2015 configuration
Efga design open source framework fabulous series (I) establishment of development environment
Cadence physical library lef file syntax learning [continuous update]
深度学习——序列模型and数学符号
直击产业落地 | 飞桨重磅推出业界首个模型选型工具