当前位置:网站首页>Introducing vant components on demand
Introducing vant components on demand
2022-04-23 12:53:00 【ZMJ_ QQ】
Installing a plug-in 、 Add the configuration
babel-plugin-import Is a babel plug-in unit , It will... During compilation import The way of writing is automatically converted to the way of introducing on demand .
# Installing a plug-in
npm i babel-plugin-import -D
// stay .babelrc Add configuration in
// Be careful :webpack 1 No need to set libraryDirectory
{
"plugins": [
["import", {
"libraryName": "vant",
"libraryDirectory": "es",
"style": true
}]
]
}
// For the use of babel7 Users of , Can be in babel.config.js Middle configuration
module.exports = {
plugins: [
['import', {
libraryName: 'vant',
libraryDirectory: 'es',
style: true
}, 'vant']
]
};
Define a js file
// Introduce on demand vant-ui Components
import {Button,List} from 'vant';
const compontent = [Button,List]
export default function install(Vue) {
if (install.installed) return
compontent.forEach(i => Vue.component(i.name, i))
}
stay main.js Register in
import vant from "./components/vantComponents";
Vue.use(vant);
Be careful : There may be Toast Useless after introduction , It can be found on the page Reintroduce .
版权声明
本文为[ZMJ_ QQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230616457107.html
边栏推荐
- SSL certificate refund instructions
- Kubernetes 入门教程
- Please help me see what this is, mysql5 5. Thanks
- Zero trust in network information security
- STM32 control stepper motor (ULN2003 + 28byj)
- BUUCTF WEB [BUUCTF 2018]Online Tool
- Use source insight to view and edit source code
- SSM framework series - data source configuration day2-1
- Can I take the CPDA data analyst certificate for 0 foundation
- php生成json处理中文
猜你喜欢
Labels and paths
基于卷积神经网络的遥感影像分类识别系统
Can I take the CPDA data analyst certificate for 0 foundation
How to prevent the website from being hacked and tampered with
Deploying MySQL in cloud native kubesphere
解锁OpenHarmony技术日!年度盛会,即将揭幕!
ZigBee CC2530 minimum system and register configuration (1)
软件测试周刊(第68期):解决棘手问题的最上乘方法是:静观其变,顺水推舟。
Introduction to metalama 4 Use fabric to manipulate items or namespaces
Zigbee之CC2530最小系统及寄存器配置(1)
随机推荐
Web17 -- use of El and JSTL
No idle servers? Import OVF image to quickly experience smartx super fusion community version
XinChaCha Trust SSL Organization Validated
Ad20 supplementary note 3 - shortcut key + continuous update
How to prevent the website from being hacked and tampered with
[wechat applet] Z-index is invalid
Synchronously update the newly added and edited data to the list
How do traditional enterprises cope with digital transformation? These books give you the answer
BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
BUUCTF WEB [BJDCTF2020]The mystery of ip
Please help me see what this is, mysql5 5. Thanks
Can I take the CPDA data analyst certificate for 0 foundation
Try the server for one month for free, and attach the tutorial
SSL证书退款说明
使用Source Insight查看编辑源代码
At instruction of nbiot
STM32 project transplantation: transplantation between chip projects of different models: Ze to C8
洛谷P5540 [BalkanOI2011] timeismoney | 最小乘积生成树 题解
软件测试周刊(第68期):解决棘手问题的最上乘方法是:静观其变,顺水推舟。
Homomorphic encryption technology learning