我正在使用 Ember Octane 版本,我想在Route
子组件中调用一个操作。伪代码如下。
**Route**
export default class SomeRouter extends Route {
model() {
return data;
}
@action
refreshRoute() {
this.refresh();
}
}
**SomerRouter.hbs**
<ChildComponent> //Using child component here
**ChildComponent**
export default class ChildComponent extends Component {
@action
revert() {
//How do I invoke the "refreshRoute" on the SomeRouter from here?
}
}
在上述子组件的 revert 方法中,“this”指的是组件本身,但在之前版本的 ember 中,“this”指的是路由器,我可以简单地调用 this.refresh()。那么我如何在 Ember Octane 中实现这一点。非常感谢任何帮助。