ol-base-components 1.0.1 → 1.0.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/main.js +3 -4
- package/src/package/index.js +15 -12
- package/src/package/table/src/index.vue +3 -1
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -3,11 +3,10 @@ import ElementUI from "element-ui";
|
|
|
3
3
|
import "element-ui/lib/theme-chalk/index.css";
|
|
4
4
|
import App from "./App.vue";
|
|
5
5
|
|
|
6
|
-
import olCom, { Swagger } from "@/package/index.js";
|
|
6
|
+
import olCom, { Swagger, SwaggerHandler } from "@/package/index.js";
|
|
7
7
|
|
|
8
|
-
Vue.use(olCom
|
|
9
|
-
|
|
10
|
-
});
|
|
8
|
+
Vue.use(olCom);
|
|
9
|
+
SwaggerHandler(Vue)
|
|
11
10
|
// Vue.config.productionTip = false;
|
|
12
11
|
Vue.use(ElementUI);
|
|
13
12
|
|
package/src/package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import OlTable from "./table";
|
|
|
2
2
|
import OlSearch from "./formSearch";
|
|
3
3
|
import Dialog from "./dialog";
|
|
4
4
|
import Swagger from "../utils/swagger";
|
|
5
|
+
import SwaggerClient from "swagger-client";
|
|
5
6
|
|
|
6
7
|
const consoleTooltip = () => {
|
|
7
8
|
// 定义颜色和样式
|
|
@@ -24,20 +25,22 @@ ${cyan}感谢使用我们的组件库,期待你的精彩应用!${reset}
|
|
|
24
25
|
`);
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
export const SwaggerHandler = async (Vue) => {
|
|
29
|
+
const client = await new SwaggerClient(
|
|
30
|
+
"http://220.179.249.140:20019/swagger/v1/swagger.json"
|
|
31
|
+
);
|
|
32
|
+
console.log("client", client);
|
|
33
|
+
Vue.prototype.$swagger = { specification: client.spec };
|
|
34
|
+
};
|
|
35
|
+
|
|
27
36
|
const components = [OlTable, OlSearch, Dialog];
|
|
28
37
|
|
|
29
|
-
const install = function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.log(3333333333, option);
|
|
36
|
-
if (option.swaggerUrl) {
|
|
37
|
-
// "http://220.179.249.140:20019/swagger/v1/swagger.json"
|
|
38
|
-
const swaggerInstance = new Swagger(option.swaggerUrl);
|
|
39
|
-
Vue.prototype.$swagger = swaggerInstance;
|
|
40
|
-
}
|
|
38
|
+
const install = function (Vue) {
|
|
39
|
+
// if (option.swaggerUrl) {
|
|
40
|
+
// // "http://220.179.249.140:20019/swagger/v1/swagger.json"
|
|
41
|
+
// const swaggerInstance = new Swagger(option.swaggerUrl);
|
|
42
|
+
// Vue.prototype.$swagger = swaggerInstance;
|
|
43
|
+
// }
|
|
41
44
|
// 遍历所有组件
|
|
42
45
|
components.map((item) => {
|
|
43
46
|
Vue.component(`ol-${item.name}`, item);
|
|
@@ -355,7 +355,9 @@ export default {
|
|
|
355
355
|
computed: {
|
|
356
356
|
bindTableColumns() {
|
|
357
357
|
// 读取接口和类型获取表头数据
|
|
358
|
-
|
|
358
|
+
if (!this.$swagger) return this.tableData.columns.filter((column) =>
|
|
359
|
+
Object.keys(column).includes("show") ? column.show : true
|
|
360
|
+
);
|
|
359
361
|
const tableColumns = this.$swagger.specification.paths[this.url].get.responses["200"].content['application/json'].schema.properties.items.items.properties
|
|
360
362
|
let swaggerColumns = Object.keys(tableColumns).reduce((acc, key) => {
|
|
361
363
|
const column = tableColumns[key];
|