zoukankan      html  css  js  c++  java
  • 我爱java系列---【弹出确认操作提示】

    1.用户点击删除按钮会执行handleDelete方法,此处需要完善handleDelete方法,弹出确认提示信息。ElementUI提供了$confirm方法来实现确认提示信息弹框效果

    // 删除
    handleDelete(row) {
    //alert(row.id);
    this.$confirm("确认删除当前选中记录吗?","提示",{type:'warning'}).then(()=>{
    //点击确定按钮时只需此处代码
    alert('用户点击的是确定按钮');
    });
    }
    

    2.发送请求

    如果用户点击确定按钮就需要发送ajax请求,并且将当前检查项的id作为参数提交到后台进行删除操作

    实现步骤:

    1. 提示是否删除

    2. 确认删除,发送axios请求,进行回调处理

      1. 删除成功,提示服务器返回的正常消息,刷新当前页面

      2. 删除失败,提示服务器返回的错误消息

        // 删除
        handleDelete(row) {
            // 提示是否删除
            this.$confirm("确定删除吗?","提示",{type:'warning'}).then(()=>{
                console.log("row id:"+row.id);
                // 确认删除,发送axios请求,进行回调处理
                axios.post(this.backend_url+"/checkitem/delete.do?id="+row.id).then((response)=>{
                    if (response.data.flag){
                        // 删除成功,提示服务器返回的正常消息
                        this.$message({
                            message:response.data.message,
                            type:'success'
                        });
                        // 刷新当前页面
                        this.findPage();
                    }else{
                        // 删除失败,提示服务器返回的错误消息
                        this.$message.error("删除失败,"+response.data.message);
                    }
                });
            });
        }
        

          

    愿你走出半生,归来仍是少年!
  • 相关阅读:
    全景3d
    node.JS
    同步、异步
    必填
    this.$http.post ||this.$http.put||vue 获取url参
    硬编码转换单位||vue
    路由下二级跳转: childen 的childen
    vue侧边栏导航和右边内容一样高
    v-for v-if || v-else
    Python_Automation_04Email_smtplib
  • 原文地址:https://www.cnblogs.com/hujunwei/p/11690825.html
Copyright © 2011-2022 走看看