安裝
npm install vant --save
// 或者
yarn add vant
引入
// 全局按需引入,在main.js中
import Vue from 'vue';
import 'vant/lib/index.css';
import { Toast, Picker, Button,} from 'vant';
Vue.use(Toast);
Vue.use(Picker);
Vue.use(Button);
//局部註冊
components: {
[Dialog.Component.name]: Dialog.Component
}
注意:
框架內有組件和函數兩種形式的。
函數形式的調用全局引入的話,是掛在到Vue 的 prototype 上掛載 dialog.alert({message: " 我是提示框哦~"})