更改 ext.msg.confirmation 弹出窗口中的按钮文本
Change buttonText in ext.msg.confirmation popup
我想将文本从“是”更改为“是!!!”从“不”到“不!!!”我尝试了很多东西,但似乎没有任何效果,
找不到关于 Sencha 的任何文档,如果有人可以帮助,谢谢
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.confirm('Confirmation', "Do you want to cancel the order?", function(btnText){
//btnText = {
// yes: "YES!!",
// no: "NO!!"
//},
//btnText.setText("YESSS!!"),
if(btnText === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(btnText === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
[解决方案]
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.show({
title: 'Title',
message: 'Message',
buttons: {
yes: 'Cancel preAuth',
no: 'Cancel the whole order',
cancel: 'Do nothing!'
},
fn: function(buttonValue, inputText, showConfig) {
if(buttonValue === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(buttonValue === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
使用 Ext.Msg.show
而不是 Ext.Msg.confirm
,并为自定义按钮文本设置 buttonText
。检查 docs 并尝试以下代码:
Ext.Msg.show({
title: 'Title',
message: 'Message',
buttons: Ext.Msg.YESNOCANCEL,
buttonText: {
yes: 'MyYes',
no: 'MyNo',
cancel: 'MyCancel'
},
icon: Ext.Msg.QUESTION,
fn: function (btn) {
if (btn === 'yes') {
console.log('MyYes');
} else if (btn === 'no') {
console.log('MyNo');
} else {
console.log('MyCancel');
}
}
});
我想将文本从“是”更改为“是!!!”从“不”到“不!!!”我尝试了很多东西,但似乎没有任何效果, 找不到关于 Sencha 的任何文档,如果有人可以帮助,谢谢
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.confirm('Confirmation', "Do you want to cancel the order?", function(btnText){
//btnText = {
// yes: "YES!!",
// no: "NO!!"
//},
//btnText.setText("YESSS!!"),
if(btnText === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(btnText === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
[解决方案]
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.show({
title: 'Title',
message: 'Message',
buttons: {
yes: 'Cancel preAuth',
no: 'Cancel the whole order',
cancel: 'Do nothing!'
},
fn: function(buttonValue, inputText, showConfig) {
if(buttonValue === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(buttonValue === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
使用 Ext.Msg.show
而不是 Ext.Msg.confirm
,并为自定义按钮文本设置 buttonText
。检查 docs 并尝试以下代码:
Ext.Msg.show({
title: 'Title',
message: 'Message',
buttons: Ext.Msg.YESNOCANCEL,
buttonText: {
yes: 'MyYes',
no: 'MyNo',
cancel: 'MyCancel'
},
icon: Ext.Msg.QUESTION,
fn: function (btn) {
if (btn === 'yes') {
console.log('MyYes');
} else if (btn === 'no') {
console.log('MyNo');
} else {
console.log('MyCancel');
}
}
});