当前位置:网站首页>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
边栏推荐
- Source code analysis of synchronousqueue
- 【unity笔记】L4Unity中的基础光照
- Recommended website for drawing result map
- Web17——EL与JSTL的使用
- Calculate the past date and days online, and calculate the number of live days
- 云原生KubeSphere部署Redis
- 世界读书日:我想推荐这几本书
- Web17 -- use of El and JSTL
- 将新增和编辑的数据同步更新到列表
- XinChaCha Trust SSL Organization Validated
猜你喜欢

Redis deployment of cloud native kubesphere

8 websites that should be known for product development to enhance work experience

SSM framework series - data source configuration day2-1

0基础可以考CPDA数据分析师证书吗

云原生KubeSphere部署Mysql

XinChaCha Trust SSL Organization Validated

天梯赛赛前练习

NPDP | how can product managers not be excluded by programmers?

Date time type in database

进程虚拟地址空间区域划分
随机推荐
进程虚拟地址空间区域划分
SSM framework series - data source configuration day2-1
Kubernets Getting started tutoriel
Can I take the CPDA data analyst certificate for 0 foundation
leetcode:437. 路径总和 III【dfs 选还是不选?】
XinChaCha Trust SSL Organization Validated
Idea的src子文件下无法创建servlet
Uni app native app local packaging integrated Aurora push (jg-jpush) detailed tutorial
NBIOT的AT指令
使用Source Insight查看编辑源代码
Number of nodes of complete binary tree
Kubernetes 入門教程
Web17——EL与JSTL的使用
Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
C, calculation code of parameter points of two-dimensional Bezier curve
梳理网络IP代理的几大用途
Calculate the past date and days online, and calculate the number of live days
Dialogue with Bruce, author of PostgreSQL: "changing careers" is to better move forward
STM32 is connected to the motor drive, the DuPont line supplies power, and then the back burning problem