我想覆盖 jQueryUI 对话框小部件内部方法。在此示例中,它仅添加“console.log('button');” 到原始函数
这是我的代码:
$.extend($.ui.dialog.prototype,
{
_createButtons: function() {
console.log('button');
var e = this, i = this.options.buttons;
return this.uiDialogButtonPane.remove(), this.uiButtonSet.empty(), t.isEmptyObject(i) || t.isArray(i) && !i.length ? (this.uiDialog.removeClass("ui-dialog-buttons"), undefined) : (t.each(i, function(i, s) {
var n, a;
s = t.isFunction(s) ? {click: s,text: i} : s, s = t.extend({type: "button"}, s), n = s.click, s.click = function() {
n.apply(e.element[0], arguments)
}, a = {icons: s.icons,text: s.showText}, delete s.icons, delete s.showText, t("<button></button>", s).button(a).appendTo(e.uiButtonSet)
}), this.uiDialog.addClass("ui-dialog-buttons"), this.uiDialogButtonPane.appendTo(this.uiDialog), undefined)
}
}
);
我收到此错误:“未捕获的 ReferenceError:t 未定义”
这里有什么问题?或者什么是完成任务的正确方法?