【发布时间】:2018-12-26 10:16:52
【问题描述】:
我有一个用 Durandal js 和 knockoutJs 包编写的 SPA,
当我运行程序时,所有在启动时触发的function () 函数,
大多数必须由某些动作触发(如点击事件等......)
它工作正常,但我不需要在启动时触发它。
怎么控制?
这是 main.js 的样子:
define(jquery, function () { return jQuery; });
define('knockout', ko);
define(['durandal/system', 'durandal/app', 'durandal/viewLocator', 'bootstrap'], function (system, app, viewLocator) {
app.title = 'Durandal Starter Kit';
app.configurePlugins({
router: true,
dialog: true
});
app.start().then(function () {
//Replace 'viewmodels' in the moduleId with 'views' to locate the view.
//Look for partial views in a 'views' folder in the root.
viewLocator.useConvention();
//Show the app by setting the root view model for our application with a transition.
app.setRoot('shell', 'entrance');
});
});
【问题讨论】:
-
触发了什么函数?你能提供一个例子或代码吗?
标签: javascript knockout.js durandal