构建使用工具:vue-cli
vant安装
1.
npm install vant --save //生产环境安装vant(是vue移动ui框架)
npm install babel-plugin-import –save-dev (plugins插件)报错–save-dev 去掉
2.
在.babelrc文件配置下Plugins
"plugins": ["transform-vue-jsx",
"transform-es2015-modules-commonjs",
"dynamic-import-node",
["import",{"libraryName":"vant","style":true}]
]
3.
在main.js文件中全局注册
Import { Button , List , swipe, swipeItem,……}from ‘vant’ //用到谁,注册谁
Vue.use(Button).use(List) .use(swipe) .use(swipeItem) //链式的使用
在需要使用的组件中引入
<template>
<div><van-button type=”primary”>默认按钮</van-button></div>
</template>