magento2后台管理账号退出时怎样加一个弹窗确认?
![](https://bbs-cdn.mallol.cn/wp-content/uploads/2021/12/1f33038ed4170a15a1b53480874e7231.png)
![](https://bbs-cdn.mallol.cn/wp-content/uploads/2021/12/1f33038ed4170a15a1b53480874e7231.png)
require([
"jquery",
'Magento_Ui/js/modal/confirm'
], function ($, confirm) {
$('.account-signout').attr('id', "signout");
$('#signout').click(function () {
var $url = $(this).attr('href');
confirm({
'content': $.mage.__('Are you sure you want to do this?'),
'actions': {
confirm: function () {
window.location = $url;
},
cancel: function () {
return false;
}
}
});
return false;
});
});
![](https://bbs-cdn.mallol.cn/wp-content/uploads/2022/07/c8b948ebcf12f65ab8a06fa366e091d4.png)
$('.admin-user .account-signout').click(function(){
return confirm('are you sure?xxx');
})
我已经写好了一个js如下,但是按钮总是需要点击两次才能关闭,这是什么原因呢,求大神再指教一下呀!