当前位置: 代码迷 >> 综合 >> vue对提示框的封装
  详细解决方案

vue对提示框的封装

热度:83   发布时间:2024-02-13 06:30:43.0

使用Modal Message 方法如下

const root = process.env.VUE_APP_URL;
import axios from "axios";
import { Modal,Message } from "view-design";deleteRow(url, ids) {return new Promise((resolve, reject) => {Modal.confirm({title: "删除提示",content: "确认删除当前数据吗?",loading: true,onOk: () => {axios.post(root + url, {ids: ids,}).then((res) => {Modal.remove();resolve(res);}).catch((err) => {Modal.remove();Message.error('删除失败')reject(err);});},});});},

LoadingBar 加载进度条

const root = process.env.VUE_APP_URL;
import axios from "axios";
import Vue from "vue";
import ViewUI from 'view-design';
Vue.use(ViewUI);filesUpload(files) {return new Promise((resolve, reject) => {ViewUI.LoadingBar.start();axios.post(root + "/files/upload", files, {headers: {"Content-Type": "multipart/form-data;",},}).then((res) => {ViewUI.LoadingBar.finish();resolve(res);}).catch((err) => {ViewUI.LoadingBar.finish();Message.error('上传失败')reject(err);});});``

 

  相关解决方案