在github.com中 搜索 Vant 查看组件库的信息https://vant-contrib.gitee.io/vant/#/zh-CN/ 组件文档安装Vant
npm i vant@next -S和npm i babel-plugin-import -D
babel-plugin-import 是一款 babel 插件,它会在编译过程中将 import 的写法自动转换为按需引入的方式。
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: [
['import', {
libraryName: 'vant',
libraryDirectory: 'es',
style: true
}, 'vant']
]
}
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'vant/lib/index.css'
import {PullRefresh,List,Popup,Grid,GridItem,AddressEdit,AddressList, Icon,SubmitBar,CheckboxGroup,SwipeCell,Stepper,Checkbox,Field,Form,Tag, Button, Image as VanImage, Card,Tab, Tabs, Swipe, SwipeItem,Lazyload,Badge,Sidebar, SidebarItem, Collapse, CollapseItem } from 'vant';
createApp(App).use(Lazyload,{loading:require('./assets/images/default.png')})
.use(Swipe)
.use(SwipeItem)
.use(Badge)
.use(Sidebar)
.use(SidebarItem)
.use(Collapse)
.use(CollapseItem) .use(Tab)
.use(Tabs)
.use(Card)
.use(VanImage)
.use(Tag)
.use(Button)
.use(Form)
.use(Field)
.use(Checkbox)
.use(Stepper)
.use(SwipeCell)
.use(CheckboxGroup)
.use(SubmitBar)
.use(Icon)
.use(AddressList)
.use(AddressEdit)
.use(GridItem)
.use(Grid)
.use(Popup)
.use(List)
.use(PullRefresh)
.use(store)
.use(router)
.mount('#app')
相关推荐
© 2020 asciim码
人生就是一场修行