confirm的用法。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        a
        {
             border-style:solid;
             border-color:#cccccc;
             border-width:1px;
             padding:2px;
             margin:0px;
             color:Black;
             font-size:smaller;
             background-color:#eeeeee;
             text-decoration:none;
             font-family:@新宋体;
             
             
            }
            
    </style>

    <script type="text/javascript">
        function con() {
            if (confirm("你确定要联系我们吗?")) {
                //window.location.href = 'http://www.baidu.com';
                //location.href = "http://www.baidu.com";
                //window.open('http://www.baidu.com');
                if (confirm("能不能不联系我们啊?") == true) {
                    return;
                }
                else {
                    window.open("http://www.baidu.com");
                }

            }
            else {
                return;
            }
        }
    </script>
</head>
<body>
<a href="#" οnclick="con()">联系我们</a>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在项目场景中,当需要在删除操作时进行二次确认弹窗时,可以使用$confirm方法来完成。具体用法如下: this.$confirm("确定删除该条数据?", "提示", { cancelButtonText: "取消", confirmButtonText: "确定", type: "warning", }).then(() => { // 在这里可以调接口,注意:.then后面要写一个回调函数 }); 其中,$confirm是一个方法,接受三个参数:弹窗的提示内容、弹窗的标题和一个配置对象。配置对象中可以设置取消按钮文本、确定按钮文本和弹窗类型。在then方法中可以写回调函数来处理删除操作的逻辑。 除此之外,你还可以根据需要封装一个公用的提示窗方法,以便在其他地方使用。例如,可以使用export关键字将这个方法导出,使其可以在其他文件中引用。 总结起来,$confirm方法用于弹出一个二次确认弹窗,在确认操作后执行相应的逻辑。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [$confirm的使用](https://blog.csdn.net/weixin_45003732/article/details/124458901)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [element中的$confirm的使用](https://download.csdn.net/download/weixin_38651929/13132792)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值