[Vue warn]: Error in v-on handler: "ReferenceError: Confirm is not defined"

来源:5-8 集成前端通用组件

N1ghtV0yager

2021-08-14

confirm.js

Confirm={
    show:function (message, callback){
        Swal.fire({
            title: '确认?',
            text: "message!",
            type: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: '删除',
            cancelButtonText: '取消'
        }).then((result) => {
            if (result.value){
                if (callback){
                    callback()
                }
            }
        })
    }
}

chapter中的del方法

del(id){
      let _this=this
      Confirm.show('删除',function (){
          //使用restful风格的url
          _this.$ajax.post('http://127.0.0.1:9000/business/admin/chapter/delete/' + id).then((response) => {
            let resp = response.data
            if (resp.success) {
              console.log('删除成功id为' + id + '的大章')
              _this.list(1)
              Toast.success('删除成功')
            }
        })
      });
    },

index.html中引入了confirm

<script src="<%= BASE_URL %>static/js/confirm.js"></script>

前端点了删除图标后报错
图片描述
toast组件可以正常使用,confirm没法正常使用,每个文件的路径都是和老师一样的

写回答

1回答

甲蛙

2021-08-16

confirm.js有没有引入呢?

//img.mukewang.com/szimg/611a1fb709554a9c07670122.jpg

0
0

Spring Cloud+ Vue前后端分离开发企业级在线视频系统

全网稀缺课程 市场热门项目+主流框架 一课掌握前后端技术

1743 学习 · 1698 问题

查看课程