VUX 是基於 WeUI 和 Vue.js 的 移動端 UI 組件庫,提供豐富的組件知足移動端(微信)頁面經常使用業務需求。
在vue-cli中使用步驟以下:javascript
npm i vux -Svue
npm i vux-loader -Djava
const vuxLoader = require("vux-loader") const webpackConfig = originalConfig //原來的module.exports 代碼賦值給變webpackConfig //注意:請把 resolve 裏的 symlink 設爲 true 若是你是使用 cnpm 進行依賴安裝 //注意:原來build/webpack.base.conf.js中的module.exports 代碼賦值給變量 webpackConfig module.exports = vuxLoader.merge(webpackConfig, { plugins: ['vux-ui', 'progress-bar', 'duplicate-style'] })
npm i less less-loader -Dwebpack
npm i yaml-loader -Dweb
import { LoadingPlugin, ToastPlugin ,AlertPlugin } from 'vux' Vue.use(LoadingPlugin) Vue.use(ToastPlugin) Vue.use(AlertPlugin)
// 顯示等待框 this.$vux.loading.show({ text: '加載中...' }); // 隱藏等待框 setTimeout(() => { this.$vux.loading.hide() }, 300); // 提示信息 this.$vux.toast.show({ type: 'text', position: 'middle', text: '請輸入查詢內容!' });