magento2后台管理账号退出时怎样加一个弹窗确认?


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;
});
});

$('.admin-user .account-signout').click(function(){
return confirm('are you sure?xxx');
})
我已经写好了一个js如下,但是按钮总是需要点击两次才能关闭,这是什么原因呢,求大神再指教一下呀!