/** * Created by c.y on 2018/3/16. * 组件的命名 项目名(F---filean) + 组件的描述(区别与框架的组件) * vux的全局弹窗toast的重新封装,主要用于后台返回错误状态的码的提示 * 以及input输入框不合要求的,弹出的提示。 */ import Vue from 'vue'; import VueRouter from 'vue-router'; import {ToastPlugin,AlertPlugin} from 'vux'; Vue.use(ToastPlugin); Vue.use(VueRouter); Vue.use(AlertPlugin); export default { // toast提示 toast(text) { Vue.$vux.toast.show({ width: '80%', type: 'text', time: 2000, position: 'middle', text: text }); }, // 对话框提示 alert(text,_this,callback) { Vue.$vux.alert.show({ title: '', content: text, onShow() { // 弹出逻辑 console.log('show'); }, onHide() { Vue.$vux.alert.hide(); if(callback){ _this.$router.push({path: '/login'}); callback(); }else{ _this.$router.push({path: '/f-login'}); } } }); } }