asc
1
フルページ検索の結果に投稿のカテゴリのクラスを追加しようとしています。modifyClass を controller/full-page-search と component/search-result-entry の両方に試しましたが、こちらの modifyClass のバグ回避策 を使用しても、console.log や alert も機能させることができません。fps-result の投稿アイテムにクラスを追加する別の方法はありますか?基本的に、フルページ検索の decorateCookedElement の同等のものを探しています。
api.modifyClass('controller:full-page-search', {
pluginId: 'mute-categories-search',
actions: {
newActionHere() {
console.log("test")
}
}
});
const controller = api.container.lookup('controller:full-page-search');
「いいね!」 1
asc
2
バッジからカテゴリリンクを見つけてトピックdivに追加するために、decoratePluginOutletを使用して階層を上下に移動することでカテゴリIDを取得しました。これを行うより良い方法はありますか?
api.decoratePluginOutlet(
"full-page-search-category",
(elem, args) => {
let searchCategory = elem.parentElement.parentElement
let fpsTopic = searchCategory.parentElement.parentElement
let category_id = searchCategory.children[0].getAttribute('href').split("/").slice(-1);
console.log(category_id)
fpsTopic.classList.add("category_" + category_id)
}
);
「いいね!」 1
david
(David Taylor)
クローズされました:
4
このトピックは3日後に自動的に閉じられました。新しい返信はもう許可されていません。