fix(table): 自定义操作按钮配置对象渲染中被就地污染,切换形态后退化为文本

This commit is contained in:
augushong
2026-09-22 12:08:44 +00:00
parent 765805ec0c
commit 53ee2e3c40

View File

@@ -1487,6 +1487,8 @@
}, },
buildOperatHtml: function (operat, data) { buildOperatHtml: function (operat, data) {
var html = ''; var html = '';
// 拷贝替代引用:后续默认值写入与格式化不得写回共享配置对象
operat = $.extend({}, operat);
operat.class = operat.class || ''; operat.class = operat.class || '';
operat.icon = operat.icon || ''; operat.icon = operat.icon || '';
operat.auth = operat.auth || 'add'; operat.auth = operat.auth || 'add';
@@ -1726,6 +1728,8 @@
} else if (typeof item === 'object') { } else if (typeof item === 'object') {
$.each(item, function (i, operat) { $.each(item, function (i, operat) {
// 拷贝替代引用:默认值写入与 url 拼接不得写回共享配置对象
operat = $.extend({}, operat);
operat.class = operat.class || ''; operat.class = operat.class || '';
operat.icon = operat.icon || ''; operat.icon = operat.icon || '';
operat.auth = operat.auth || 'add'; operat.auth = operat.auth || 'add';