vue中alert toast confirm loading 公用
import Vue from 'vue'import { ToastPlugin, AlertPlugin, ConfirmPlugin, LoadingPlugin } from 'vux'/*import { Promise } from 'es6-promise';*/Vue.use(ToastPlugin)Vue.use(AlertPlugin)Vue.use(ConfirmPlugin)Vue.use(LoadingPlugin)const Message = {};Message.install = () => { const msg = { $toast: config => { let def = { type:'text', text:'' } if(typeof config === 'string' || typeof config === 'number'){ Vue.$vux.toast.show({type:'text',text:config}) }else{ Vue.$vux.toast.show(Object.assign(def,config)) } }, $alert: config => { let def = { title:'提示', content:'系统异常,请重新登录后再试!', buttonText:'确定' } if(typeof config === 'string' || typeof config === 'number'){ Vue.$vux.alert.show(Object.assign(def,{content:config})); }else{ Vue.$vux.alert.show(Object.assign(def,config)); } }, $confirm: config => { let isConfirm = false; let def = { title:'提示', content:'系统异常,请重新登录后再试!', confirmText:'确定', cancelText:'取消', onConfirm:() =>{ isConfirm = true; } } if(typeof config === 'string' || typeof config === 'number'){ Vue.$vux.confirm.show(Object.assign(def,{content:config})); }else{ Vue.$vux.confirm.show(Object.assign(def,config)); } /*return new Promise((resolve,reject) => { if(isConfirm){ resolve(); } })*/ }, $showLoading: config => { let def = { text: '加载中...' } if(typeof config === 'string' || typeof config === 'number'){ Vue.$vux.loading.show(Object.assign(def,{text:config})); }else{ Vue.$vux.loading.show(Object.assign(def,config)); } } } Object.entries(msg).forEach(([method,fn]) => { Vue.prototype[method] = fn; })}Vue.use(Message)vue中alert toast confirm loading 公用的更多相关文章
- 去掉网页中alert和confirm弹出框自带的网址
去掉网页中alert和confirm弹出框自带的网址 Alert: <script> window.alert = function(name){ var iframe = documen ...
- vue 中使用 Toast弹框
import { ToastPlugin,ConfirmPlugin,AlertPlugin} from 'vux' Vue.use(ToastPlugin) Vue.use(ConfirmPlugi ...
- Vue自定义全局Toast和Loading
如果我们的Vue项目中没有用到任何UI框架的话,为了更好的用户体验,肯定会用到loading和toast.那么我们就自定义这两个组件吧. 1.Toast组件 首先,在common下新建global文件 ...
- Vue 中使用 extent 开发loading等全局 组件
Vue 中使用 extend 开发组件 简介:再开发过程中那面会遇到自定义 loading alert 等全局组件,这里我们可以使用 vue 中的extend 来帮助我们完成 一个简单extend例子 ...
- vue中的toast组件
首先在components新建组件文件夹 随后在toast.vue中写入弹框样式 <template> <transition name="demo"> & ...
- vue中自定义组件(插件)
vue中自定义组件(插件) 原创 2017年01月04日 22:46:43 标签: 插件 在vue项目中,可以自定义组件像vue-resource一样使用Vue.use()方法来使用,具体实现方法: ...
- Ionic4.x Javascript 扩展 ActionSheet Alert Toast Loading 以及 ionic 手势相 关事件
1.ActionSheet 官方文档:https://ionicframework.com/docs/api/action-sheet <ion-header> <ion-toolb ...
- Bootstrap Modal 框 alert confirm loading
/** * Created by Administrator on 2016/5/4. */ /** * 模态窗口 */ window.Modal = { tpls:{ alert:'<div ...
- Android线程中使用Toast、dialog、loading
代码改变世界 Android线程中使用Toast.dialog.loading Loading: Thread t1 = new Thread(new Runnable() { @Override p ...
随机推荐
- colgroup和col的区别
转载自:http://blog.csdn.net/carefree31441/article/details/3291397 colgroup和col一般出现在表格当中定义表格单独列的任意属性col能 ...
- python 协程 demo
# -*- coding: UTF- -*- import gevent from gevent import socket from gevent import event rev=socket.s ...
- Django中ORM系统多表数据操作
一,多表操作之增删改查 1.在seting.py文件中配置数据库连接信息 2.创建数据库关联关系models.py from django.db import models # Create your ...
- Jmeter干货 不常用却极其有用的几个地方
1. Jmeter测试计划下Run Thread Groups consecutively 表示序列化执行测试计划下所有线程组中的各个请求 如下图配置,新建的测试计划中,不默认勾选此项, 而享用Jme ...
- [转][cesium]1.添加本地服务器
转自:http://www.cnblogs.com/fuckgiser/p/5633748.html 此系列cesium总教程: https://www.cnblogs.com/fuckgiser/ ...
- [osg][osgEarth][原]基于OE自定义自由飞行漫游器(第二版)
在初级版上,进行新的漫游方式调整 头文件: #pragma once //南水之源 20180101 #include <osgGA/CameraManipulator> #include ...
- download 属性
1.使用场景 对浏览器 识别/不识别 的文件下载 2.核心代码 var eleTextarea = document.querySelector('textarea'); var eleButton ...
- vue-cli webpack打包不.map文件,iview 项目打包完,图标路径有问题
vue 项目打包出来有时候体积有点大,其实基本都是.map文件比较大,这些文件对项目没什么影响,可以直接在打包时候就不生成.map文件这样就不用每次删那么麻烦了, 做法: config中知道 inde ...
- Python自学:第二章 合并(拼接字符串)
first_name = "ada" last_name = "lovelace" full_name = first_name + " " ...
- Vue.js示例:文本编辑器。使用_.debounce()反抖动函数
Markdown编辑器 https://cn.vuejs.org/v2/examples/index.html 新知识: Underscore.js库 用于弥补标准库,方便了JavaScript的编程 ...