ol-base-components 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/run.js +1 -0
- package/src/api/runApi.js +8 -3
- package/src/package/index.js +9 -1
package/package.json
CHANGED
package/src/api/run.js
CHANGED
package/src/api/runApi.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const SwaggerClient = require("swagger-client");
|
|
4
|
+
const Vue = require("vue"); // 引入 Vue
|
|
4
5
|
|
|
5
|
-
const swaggerUrl = "http://220.179.249.140:20019/swagger/v1/swagger.json";
|
|
6
|
+
// const swaggerUrl = "http://220.179.249.140:20019/swagger/v1/swagger.json";
|
|
7
|
+
|
|
8
|
+
const swaggerUrl = Vue.prototype.$swaggerUrl || ""; // 使用 Vue.prototype 中的 url
|
|
9
|
+
const modulesDir =
|
|
10
|
+
Vue.prototype.$outputDir || path.join(__dirname, "./modules"); // 使用 Vue.prototype 中的 outputDir
|
|
6
11
|
|
|
7
12
|
SwaggerClient(swaggerUrl)
|
|
8
13
|
.then((client) => {
|
|
@@ -10,7 +15,7 @@ SwaggerClient(swaggerUrl)
|
|
|
10
15
|
|
|
11
16
|
const apiModules = generateApiModules(swaggerData);
|
|
12
17
|
// 创建文件夹
|
|
13
|
-
const modulesDir = path.join(__dirname, "./modules");
|
|
18
|
+
// const modulesDir = path.join(__dirname, "./modules");
|
|
14
19
|
if (!fs.existsSync(modulesDir)) {
|
|
15
20
|
fs.mkdirSync(modulesDir);
|
|
16
21
|
console.log(`创建了文件夹: ${modulesDir}`);
|
package/src/package/index.js
CHANGED
|
@@ -184,7 +184,15 @@ function hideLoading() {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
const install = async function (
|
|
187
|
+
const install = async function (
|
|
188
|
+
Vue,
|
|
189
|
+
options = {
|
|
190
|
+
swaggerUrl: "",
|
|
191
|
+
outputDir:''
|
|
192
|
+
}
|
|
193
|
+
) {
|
|
194
|
+
if (options && options.swaggerUrl) Vue.prototype.$swaggerUrl = options.swaggerUrl;
|
|
195
|
+
if (options && options.outputDir) Vue.prototype.$outputDir = options.outputDir;
|
|
188
196
|
components.map((item) => {
|
|
189
197
|
Vue.component(`ol-${item.name}`, item);
|
|
190
198
|
});
|