我们目前有
<script type="text/discourse-plugin" version="1.4.0">
const controller = container.lookup('controller:topic');
const controllerNavCategory = container.lookup('controller:navigation/category');
const currCategory = controller?.get('model.category_id') || controllerNavCategory?.get("category.id");
console.log('currCategory ', currCategory )
</script>
这运行良好,但现在我看到一个警告:
弃用通知:controller:navigation/category 不再存在,此 shim 最终将被移除。要获取有关当前发现路由的信息,请改用 discovery 服务。[deprecation id: discourse.navigation-category-controller]
如何更新此代码以使用新的 discovery 服务?谢谢。