AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
~~~ $('.deliveryAddress select').select2({ matcher: (params, data)=>{ // If there are no search terms, return all of the data if ($.trim(params.term) === '') { return data; } // Do not display the item if there is no 'text' property if (typeof data.text === 'undefined') { return null; } // `params.term` should be the term that is used for searching // `data.text` is the text that is displayed for the data object let keywords = params.term.split(' '); let matchCounter = 0; $.each(keywords, function(index, keyword) { let text = data.text.toLowerCase(); text.indexOf(keyword.toLowerCase()) > -1 && matchCounter++; }); if (matchCounter == keywords.length) { // This includes matching the `children` how you want in nested data sets return $.extend({}, data, true); } // Return `null` if the term should not be displayed return null; } }); ~~~