草庐IT

durandal

全部标签

javascript - 如何在 Durandal 中为我的 shell viewmodel 使用一个类?

我正在查看HotTowel模板,并试图让它在TypeScript中工作,我在转换shellView模型时遇到了问题。我正在尝试将其转换为TS,这对我来说更有意义,它应该是一个类,而不是像所示那样简单地导出函数here.我看了thisapproach但是,注意评论here,决定不遵循它。经过一番挖掘,我找到了thisthread,这表明它应该像重写router.getActivatableInstance一样简单,但我似乎还无法调用该函数。这是我的main.ts(也包含在一个类中)://///////import_app=module('durandal/app');import_sys

javascript - Gulpfile.js 加载失败

VisualStudio任务运行程序无法加载gulp文件。我现在用的是VS2017v15.9.4,不过这个项目是几年前开发的。Failedtorun"...\Gulpfile.js"...cmd.exe/cgulp--tasks-simpleassert.js:350throwerr;^AssertionError[ERR_ASSERTION]:TaskfunctionmustbespecifiedatGulp.set[as_setTask](...\node_modules\undertaker\lib\set-task.js:10:3)atGulp.task(...\node_mo

javascript - 在 Durandal 构建中从优化中排除文件

我正在使用Grunt构建Durandalstarterkitpro包。一切正常,除了一个小细节。我想从优化器中排除一个文件(下面的app-config),并在我的构建完成后将其保留为非缩小文件。根据其他SO线程建议,我目前使用empty:将其排除,这会按预期将其从优化文件中删除。但是,当我打开构建的项目时,控制台出现错误:UncaughtError:主要缺少app-configoptions:{name:'../lib/require/almond-custom',baseUrl:requireConfig.baseUrl,mainPath:'app/main',paths:mixIn

javascript - 在 durandal 中长时间运行负载操作

我正在尝试找出运行长时间运行的加载操作的最佳位置是使用Durandal。据我所知,加载数据的一般建议是在ViewModel的activate方法中,这是我通常做的-类似于:viewModel.activate=function(){varloadPromise=myService.loadData();return$.when(loadPromise).then(function(loadedData){viewModel.data(data);});};我知道如果我不返回此处的promise,那么绑定(bind)通常会出现问题-如thisquestionandanswerindica

javascript - 多个 SPA 的 Durandal 和 MVC4 区域

我有一个带区域的互联网应用程序mvc4,对于我的组织,每个区域代表一个SPA,通过“管理NuGet包”,我安装了“Durandal1.2.0”、“DurandalTransitions1.2.0”和“DurandalRouter1.2.0””。我整理了文件夹并从Durandal的文件夹“App”中退出了“views”和“viewmodels”,并将新View放在mvc4区域的文件夹“VIews”中,例如:Areas-->NewArea-->Views-->ControllerFolder-->views-->shell.html例如,然后我将“viewmodels”放入“Script”

javascript - KO找不到带ID的模板

我以前使用过Knockout模板,所以我不确定为什么这对我不起作用。我尝试了两种不同风格的ko标记,都没有用。//bothofthesemethodsfail我刚收到错误“无法找到ID为tp-ed-templ的模板”。可能只是一个打字错误,但我没能找到它。我在Durandal的上下文中使用KO,尽管这应该没有什么不同。尝试在使用前声明模板,但没有帮助。Someoneelseranintothesamethingwithnosolutioneither这似乎是Durandal的问题,而不是Knockout。我在vanilladurandal设置中尝试了一些非常简单的案例,它仍然做同样的事

javascript - Durandal 谷歌分析跟踪

我正在使用Durandal1.2和DurandalRouterPlugin并希望通过GoogleAnalytics跟踪SPA中的页面浏览量:window._gaq.push(['_trackPageview',location.pathname+location.search+location.hash]我知道我可以监听hashchange事件,甚至可以通过SammyHook.我宁愿不这样做,因为Durandal目前正在rewritten移除对Sammy的依赖。我的问题是,有没有办法使用Durandal路由器插件进行设置? 最佳答案

javascript - 类似于 Prism for Knockout js 的框架

Microsoft为Silverlight和WPF制作了Prism框架。它的RegionManager和其他东西看起来很棒。Knockout有没有类似的框架?谢谢。 最佳答案 RobEisenberg,Caliburn.Micro的开发者(IMO是可用于XAML应用程序的最佳MVVM框架)正在开发使用Knockout的Durandal。源的早期版本是here,你可以阅读一些关于设计概念的信息here. 关于javascript-类似于PrismforKnockoutjs的框架,我们在St

javascript - Durandal.js - 组合与小部件

我想创建一个div(基本上它会包含列表框),我想在不同的页面中使用该div,哪个是在duarandal.js中使用的最佳选择?Compositionhttp://durandaljs.com/documentation/Using-Composition/Widgethttp://durandaljs.com/documentation/Creating-A-Widget/ 最佳答案 一般来说,将compose绑定(bind)用作模板,将小部件用作用户控件您的问题中没有足够的信息,我无法就哪个是您的正确选择提供建议,但我会在下面对两

javascript - Durandal 中的多级路由

我正在查看Durandal示例,试图了解路由的工作原理。shell.js指定了这些路由:{route:['','knockout-samples*details'],moduleId:'ko/index',title:'Details...',nav:true,hash:'#knockout-samples'},{route:'view-composition',moduleId:'viewComposition/index',title:...在knockout-samples下:{route:'',moduleId:'helloWorld/index',title:'HelloWo
12