Ser*_*ver 2 javascript requirejs cordova windows-phone-8
我有一个使用requirejs加载其模块的Web应用程序.Web应用程序在任何桌面浏览器中都可以正常运行,在与Cordova打包时也可以在iOS和Android上运行.但是在构建Windows Phone 8 Cordova应用程序时不起作用.
我收到以下错误:
"未找到视图:通过路径"text!views/shell.html"搜索"views/shell"
(我正在使用Durandal)
我有以下应用程序结构:
www/app/main.js包含以下代码:
requirejs.config({
//baseUrl: 'x-wmapp0:www/app',
baseUrl: 'app',
enforceDefine: true,
paths: {
'text': '../lib/require/text',
'durandal':'../lib/durandal/js',
'plugins' : '../lib/durandal/js/plugins',
'transitions' : '../lib/durandal/js/transitions',
'knockout': '../lib/knockout/knockout-2.3.0',
'bootstrap': '../lib/bootstrap3/js/bootstrap',
'jquery': '../lib/jquery/jquery-1.9.1',
'modules' : 'modules'
},
shim: {
'bootstrap': {
deps: ['jquery'],
exports: 'jQuery'
}
}
});
define(['durandal/system', 'durandal/app', 'durandal/viewLocator', 'bootstrap'], function (system, app, viewLocator, bootstrap) {
//>>excludeStart("build", true);
system.debug(true);
//>>excludeEnd("build");
app.title = 'MyApp';
app.configurePlugins({
router: true,
dialog: true,
widget: 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('viewmodels', 'views', 'views');
//Show the app by setting the root view model for our application with a transition.
app.setRoot('viewmodels/shell', 'entrance', 'applicationHost');
});
});
Run Code Online (Sandbox Code Playgroud)
此代码适用于除WP8之外的所有设备.我尝试使用baseUrl:'x-wmapp0:www/app'来设置WP8 Cordova内部使用的实际路径,但这不起作用.那是因为它不是以'/'或http开头的路径吗?
有关如何配置requirejs以使用requirejs加载模块和视图的任何想法?
看看这对你有什么帮助http://mikaelkoskinen.net/durandal-phonegap-windows-phone-8-tutorial/
此外,截至2013年10月18日,Phonegap Build还增加了对WP8的测试版支持.添加"winphone:作为差距:平台,并确保你使用phonegap 3.0.我们目前没有运气,但也许你可以使用它.
| 归档时间: |
|
| 查看次数: |
1628 次 |
| 最近记录: |