当前位置:网站首页>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
边栏推荐
- uni-app 原生APP-本地打包集成极光推送(JG-JPUSH)详细教程
- Stm32cubeprogrammer basic instructions
- 免费试用一个月的服务器,并附上教程
- BUUCTF WEB [BJDCTF2020]The mystery of ip
- [Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)
- Use source insight to view and edit source code
- Homomorphic encryption technology learning
- AD20补充笔记3—快捷键+持续更新
- Kubernetes 入門教程
- 云原生KubeSphere部署Mysql
猜你喜欢
Pre competition practice of TIANTI competition
数据库中的日期时间类型
产品开发都应该知道的8个网站,增强工作体验
Object.keys后key值数组乱序的问题
How to prevent the website from being hacked and tampered with
CVPR 2022&NTIRE 2022|首个用于高光谱图像重建的 Transformer
31. 下一个排列
Plato Farm-以柏拉图为目标的农场元宇宙游戏
Introduction to kubernetes
leetcode:437. Path sum III [DFS selected or not selected?]
随机推荐
风尚云网学习-input属性总结
Process virtual address space partition
PHP generates JSON to process Chinese
What are the forms of attack and tampering on the home page of the website
31. 下一个排列
Web17——EL与JSTL的使用
SSM框架系列——注解开发day2-2
洛谷P5540 [BalkanOI2011] timeismoney | 最小乘积生成树 题解
梳理網絡IP代理的幾大用途
教你快速开发一个 狼人杀微信小程序(附源码)
Synchronously update the newly added and edited data to the list
Labels and paths
Please help me see what this is, mysql5 5. Thanks
22. 括号生成
Pre competition practice of TIANTI competition
有趣的IDEA插件推荐,给你的开发工作增添色彩
Buuctf Web [gxyctf2019] no dolls
[vulnhub range] - DC2
梳理网络IP代理的几大用途
如何实现点击一下物体播放一次动画