vue 封装的公共js文件中,如何使用iview中的提示框

vue 封装的公共js文件中,如何使用iview中的提示框_第1张图片

使用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);
        });
    });

``

你可能感兴趣的:(前端开发,iview,vue,upload)