1

我真的不明白如何将 proj4.js 包含到我的项目中。按照我应该添加的文档

<script src="lib/proj4js-combined.js"></script>

在代码中。但是如果我将它添加到 .html 文件中,我的 .js 文件(我将在其中使用 proj4js 函数)将看不到它。而且我无法将它添加到我的 .js 文件中,因为它是 .js 文件而不是 .html 文件。你是怎么做到的?谢谢

4

2 回答 2

0

Add it to your html file, and then add your other js file(the one that will use the 1st js file) right after it.

Like this:

<head>
    <script src="1stfile.js" type="text/javascript"></script>
    <script src="secondfile.js" type="text/javascript"></script>
</head> 
于 2015-04-23T09:37:45.713 回答
0

If you just load them in order (in your html file):

<html>
    <head>
        <script src="lib/proj4js-combined.js"></script>
        <script src="myfolder/js-file-with-proj4js-functions.js"></script>
    </head> 
<body>
    ...

Then your js file will be able to see everything it needs from the library.

于 2015-04-23T09:37:46.663 回答