0

使用生成的默认 Yeoman 默认 Oracle 仪表板的一部分来说明我的问题:

../src/index.html
../src/js/appController.js
../src/js/main.js
../src/js/views/dashboard.html 
../src/js/views/customers.html
../src/js/viewModels/dashboard.js
../src/js/viewModels/customers.js

如果我在仪表板模块中并且我想要类似的东西

 function DashboardViewModel() {
...
self.currentRowListener = function (event, ui) {
Router.rootInstance.go('customers');
}
...

我怎样才能做到这一点?我找不到从特定模块重定向到另一个模块的方法

4

1 回答 1

1

Router.go功能是正确的方法,您只需使用oj.Router.rootInstance. 如果你正确配置了你的路由器——我想这是你使用默认模板的情况——这应该就是全部了。

例子:

define(['ojs/ojcore', 'ojs/ojrouter'], function (oj) {
    function DashboardViewModel() {
        var self = this;
        self.currentRowListener = function (event, ui) {
            oj.Router.rootInstance.go('customers');
        }
    }
    return DashboardViewModel;
});
于 2017-02-24T07:55:40.377 回答