我正在尝试使用RequireJS在CCSEQ.WebAPI.js
文件中包含ExpenseUpload.js
。根据{{3}} RequireJS的基本URL是html文件中指定的data-main
文件夹(在我的情况下为WebResources/js/main
)。但是,尽管尝试了各种不同的相对路径组合,但我无法包含CCSEQ.WebAPI.js
文件。
我尝试使用/../
开始我的相对路径,在配置中指定baseURL
,并将我的CCSEQ.WebAPI.js
文件移动到文件夹结构中的不同位置,但没有成功。
有人看到我在这里犯的错误吗?
- WebResources
- js
- html
- ExpenseUpload.html
- lib
- CCSEQ.WebAPI.js
- main
- ExpenseUpload.js
<!DOCTYPE html>
<html lang="en" ng-app="expenseUploadApp">
<head>
<meta charset="utf-8" />
<title>Expense Upload</title>
<link rel="icon" href="data:;base64,iVBORwOKGO=" />
<link href="../css/ExpenseUpload.css" rel="stylesheet" />
</head>
<body ng-controller="DisplayCtrl">
<h1>Expense Upload</h1>
<form>
<label>Month:</label>
<select ng-model="selectedMonth" ng-options="x for x in months">
</select>
<label>Year:</label>
<select ng-model="selectedYear" ng-options="y for y in years">
</select><br/>
<input type="file" id="csv-file" name="files" />
</form>
<script src="../../Scripts/jquery-3.1.1.js"></script>
<script src="../../Scripts/papaparse.js"></script>
<script src="../../Scripts/angular.js"></script>
<script src="../js/modules/ExpenseUploadModule.js"></script>
<script src="../js/controllers/ExpenseUploadController.js"></script>
<script src="../../Scripts/require.js" data-main="../js/main/ExpenseUpload.js"></script>
<!--<img id="loading" src="../../Images/loading.gif" />-->
</body>
</html>
requirejs.config({
bundles: {
'../lib/CCSEQ.WebAPI.js': ['Model/ExpenseTransaction', 'Model/ExpenseTransactionSet', 'API/ExpenseTransaction', 'API/ExpenseTransactionSet']
}
});
require(["Model/ExpenseTransaction", "Model/ExpenseTransactionSet", "API/ExpenseTransaction", "API/ExpenseTransactionSet"], function (ExpenseTransactionModel, ExpenseTransactionSetModel, ExpenseTransactionAPI, ExpenseTransactionSetAPI) {
// Code Here
});
答案 0 :(得分:0)
根据http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm,它说
baseUrl通常设置为与data-main属性中使用的脚本相同的目录。
因此,您的baseUrl
是main
文件夹,lib
处于同一级别。
因此在捆绑包中使用lib/CCSEQ.WebAPI.js