uniapp引入vant-weapp
时间: 2023-08-04 13:09:05 浏览: 196
在uniapp中引入vant-weapp组件库可以通过以下步骤进行配置。首先,在需要使用组件的页面的style中设置usingComponents引入vant-weapp组件的路径。例如,在pages数组中的某个页面的style中添加以下代码:
```
"usingComponents": {
"van-button": "/wxcomponents/vant-weapp/button/index",
"van-sidebar": "/wxcomponents/vant-weapp/sidebar/index",
"van-sidebar-item": "/wxcomponents/vant-weapp/sidebar-item/index",
"van-icon": "/wxcomponents/vant-weapp/icon/index"
}
```
其中,"van-button"、"van-sidebar"、"van-sidebar-item"和"van-icon"是你想要引入的vant-weapp组件的名称,后面的路径是组件的相对路径。你可以根据自己的需要引入不同的组件。
另外,还需要在全局配置文件中的usingComponents中添加vant-weapp组件的路径。例如,在配置文件中的pages数组中的某个页面的style中添加以下代码:
```
"usingComponents": {
"van-button": "/wxcomponents/vant-weapp/button/index"
}
```
这样就完成了在uniapp中引入vant-weapp组件库的配置。你可以根据需要在不同的页面中引入不同的vant-weapp组件。
#### 引用[.reference_title]
- *1* *3* [uni-app引入vant Weapp](https://blog.csdn.net/YNEWA/article/details/106056610)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [uniapp引入Vant Weapp](https://blog.csdn.net/m0_48259951/article/details/129733632)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文