您好!
我想使用插件 API 修改控制器,但失败了,并出现警告:
[THEME xxx] “controller:full-page-search” 已在容器中缓存。更改将不会生效。
我的代码:
function modifySearchTypes(api) {
api.modifyClass("controller:full-page-search", {
pluginId: "modify-search-types",
init() {
this._super(...arguments);
this.set("searchTypes", [
{ name: I18n.t("search.type.default"), id: SEARCH_TYPE_DEFAULT },
{
name: this.siteSettings.tagging_enabled
? I18n.t("search.type.categories_and_tags")
: I18n.t("search.type.categories"),
id: SEARCH_TYPE_CATS_TAGS,
},
]);
this.selected = [];
},
});
}
export default {
name: "modify-search-types",
initialize() {
withPluginApi("0.10.0", modifySearchTypes);
},
};
我该如何处理?
非常感谢!