smk*_*std 19 ionic-framework ionic ionic-popup
我正在使用$ ionicPopup.confirm()但我想更改"取消按钮"文本.有可能这样做吗?
我知道.show()语法:
buttons: [
{ text: 'Cancel' }
]
Run Code Online (Sandbox Code Playgroud)
但它似乎不适用于.confirm()......
感谢4的帮助
bax*_*ico 30
至少在Ionic(1.0.0)的最新版本中,您可以执行以下操作:
var confirmPopup = $ionicPopup.confirm({
title: 'Popup title',
template: 'Popup text',
cancelText: 'Custom cancel',
okText: 'Custom ok'
}).then(function(res) {
if (res) {
console.log('confirmed');
}
});
Run Code Online (Sandbox Code Playgroud)
这是相关文档.
aor*_*vre 11
更新:on ionic 1.0.0,现在可以,请点击此处
showConfirm选项:
{
title: '', // String. The title of the popup.
cssClass: '', // String, The custom CSS class name
subTitle: '', // String (optional). The sub-title of the popup.
template: '', // String (optional). The html template to place in the popup body.
templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.
cancelType: '', // String (default: 'button-default'). The type of the Cancel button.
okText: '', // String (default: 'OK'). The text of the OK button.
okType: '', // String (default: 'button-positive'). The type of the OK button.
}
Run Code Online (Sandbox Code Playgroud)
是的,你可以使用ionic popup.show做你想要的视频并绑定Cancel事件.
$ionicPopup.show({
template: msg,
title: titleConfirm,
buttons: [
{ text: "BTN_NO",
onTap:function(e){
return false;
}
},
{ text: "BTN_OK",
onTap:function(e){
return true;
}
},
]
});
Run Code Online (Sandbox Code Playgroud)
在对离子popover.confirm功能进行调查后,无法对其进行自定义.popover.confirm的值是硬编码的行446
function showConfirm(opts) {
return showPopup(extend({
buttons: [{
text: opts.cancelText || 'Cancel',
type: opts.cancelType || 'button-default',
onTap: function() { return false; }
}, {
text: opts.okText || 'OK',
type: opts.okType || 'button-positive',
onTap: function() { return true; }
}]
}, opts || {}));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21575 次 |
| 最近记录: |