当前位置:网站首页>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
边栏推荐
- CGC: contractual graph clustering for community detection and tracking
- Idea的src子文件下无法创建servlet
- 天梯赛赛前练习
- Softbank vision fund entered the Web3 security industry and led a new round of investment of US $60 million in certik
- Date time type in database
- SSL certificate refund instructions
- bert-base-chinese下载(智取)
- Markdown grammar learning
- STM32 is connected to the motor drive, the DuPont line supplies power, and then the back burning problem
- XinChaCha Trust SSL Organization Validated
猜你喜欢
Use source insight to view and edit source code
Remote access to raspberry pie at home (Part 1)
0基础可以考CPDA数据分析师证书吗
SSL证书退款说明
Kubernetes 入門教程
CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction
Sort out several uses of network IP agent
XinChaCha Trust SSL Organization Validated
Calculate the past date and days online, and calculate the number of live days
Introduction to servlet listener & filter
随机推荐
php生成json处理中文
31. 下一个排列
Date time type in database
Please help me see what this is, mysql5 5. Thanks
Fashion cloud learning - input attribute summary
[vulnhub range] - DC2
21 天学习MongoDB笔记
box-sizing
How do traditional enterprises cope with digital transformation? These books give you the answer
C, calculation code of parameter points of two-dimensional Bezier curve
Web17——EL与JSTL的使用
Uni app native app cloud packaging integrated Aurora push (jg-jpush) detailed tutorial
Wonderful review | the sixth issue of "source" - open source economy and industrial investment
ZigBee CC2530 minimum system and register configuration (1)
BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
leetcode-791. Custom string sorting
bert-base-chinese下载(智取)
标签与路径
Plato farm - a game of farm metauniverse with Plato as the goal
uni-app 原生APP-本地打包集成极光推送(JG-JPUSH)详细教程