全局Loading(自定义Loading)

在调用的方法中加入(中间注释部分,为请求数据方法,结束都需要关闭loading)

 const loading = this.$loading({
        lock: true,
        text: '正在努力加载数据中,请耐心等待...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      //     // 请求数据
      //     pageGraduationList().then(res => {
      //   if (res.code === 200) {
      //     // 请求成功后关闭 loading 效果
      //     loading.close()
      //   } else {
      //     this.$notify({
      //       title: '错误',
      //       message: res.message,
      //       type: 'error'
      //     })
      //     // 请求失败后关闭 loading 效果
      loading.close()
//   }
      // })

 

posted @ 2022-11-03 10:02  joyfulest  阅读(158)  评论(0)    收藏  举报