Vue移動端UI組件庫Vant

安裝

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使this.dialog 等方法,直接使用this.dialog.alert({message: " 我是提示框哦~"})

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章