使用Durandal dojoConfig和ESRI Maps [英] Using Durandal dojoConfig and ESRI Maps

查看:137
本文介绍了使用Durandal dojoConfig和ESRI Maps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用与Durandal合作的ESRI地图,并在Durandal文档中查看了此链接 DurandalEsri

I'm trying to get ESRI maps working with Durandal and came across this link in the Durandal docs DurandalEsri

这似乎很有效,但是现在Durandal在找到我的.js文件时遇到问题。如果我离开以下dojoConfig,我的脚本被找到,但是地图将无法正常工作。

This seems to work but now Durandal is having problems finding some of my .js files. If I leave the following dojoConfig out my scripts are found but then the maps won't work.

`var dojoConfig = {
    baseUrl: './',
    async: true,
    tlmSiblingOfDojo: true,
    parseOnLoad: false,
    aliases: [['text', 'dojo/text']],
    packages: [
        { name: 'esri', location: '//serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri' },
        { name: 'dojo', location: '//serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dojo' },
        { name: 'dojox', location: '//serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dojox' },
        { name: 'dijit', location: '//serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit' },
        { name: 'durandal', location: 'App/durandal' },
        { name: 'views', location: 'App/views' },
        { name: 'viewmodels', location: 'App/viewmodels' },
        { name: 'lib', location: 'App/lib' }
    ]
};`

我的应用程序结构如下所示:

My app structure looks like this:


  • App

    • durandal

    • lib

    • 服务

    • viewmodels

    • 视图

    • App
      • durandal
      • lib
      • services
      • viewmodels
      • views

      所以在我的shell.js文件中,如果我尝试传入'lib / config',我得到一个404因为它试图在localhost / lib / config.js找到配置文件,而不是localhost / dashboard / app / lib / config.js

      So in my shell.js file if I try to pass in 'lib/config' I get a 404 because it tried to find the config file at localhost/lib/config.js instead of localhost/dashboard/app/lib/config.js

      如果我通过仪表板/ app / lib / config'到shell.js文件将会被发现,但是似乎不应该指定整个路径,因为'durandal / system'和'durandal'文件夹下的其他任何东西被正确找到

      If I pass 'dashboard/app/lib/config' to shell.js the file will be found, but it doesn't seem like I should have to specify the entire path, since 'durandal/system' and anything else under the 'durandal' folder get found correctly.

      任何想法?

      推荐答案

      所以对于我的场景的Durandal + Esri + Dojo,我不得不放弃与Durandal一起提供的require.js文件,并使用dojo AMD加载程序。不幸的是,我不知道这可能导致什么未来的问题。
      可以找到更多信息 here

      So for my scenario of Durandal + Esri + Dojo, I had to leave out the require.js file that is included with Durandal and use the dojo AMD loader. Unfortunately I have no idea what future problems this might cause. More info can be found here

      这篇关于使用Durandal dojoConfig和ESRI Maps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆