我正在嘗試更改 node_modules Angular 6 項目中的 select2.jull.js 文件。到目前為止,我找到了一些方法來做到這一點,但沒有任何效果對我有用,你會喜歡我如何在 select2 文件中用 startMatcher 替換wrappedMatcher 的任何建議嗎?S2.define('select2/compat/matcher',[ 'jquery'], function ($) { function oldMatcher (matcher) { function wrappedMatcher (params, data) { var match = $.extend(true, {}, data); if (params.term == null || $.trim(params.term) === '') { return match; } if (data.children) { for (var c = data.children.length - 1; c >= 0; c--) { var child = data.children[c]; // Check if the child object matches // The old matcher returned a boolean true or false var doesMatch = matcher(params.term, child.text, child); // If the child didn't match, pop it off if (!doesMatch) { match.children.splice(c, 1); } } if (match.children.length > 0) { return match; } } if (matcher(params.term, data.text, data)) { return match; } return null; } return wrappedMatcher; } return oldMatcher;});
node_modules select2 將wrappedMatcher 替換為
慕田峪7331174
2023-12-14 14:13:31