ol-base-components 3.3.7 → 3.3.9

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.
@@ -0,0 +1,2 @@
1
+ 这是一个发布到npm上的组件库
2
+ 不要用?. 因为vue版本问题
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "3.3.7",
3
+ "version": "3.3.9",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/App.vue CHANGED
@@ -449,6 +449,7 @@ export default {
449
449
  mounted() {
450
450
  // const el = document.getElementById("ellipsis-container");
451
451
  // this.truncateMiddleByWidth(el)
452
+ console.log(6666, this, this.$olBaseConfig);
452
453
  },
453
454
  methods: {
454
455
  SelectionChange(row) {
package/src/main.js CHANGED
@@ -6,7 +6,7 @@ import OlCom, { swaggerInstall, Hiprint } from "@/package/index.js";
6
6
  Vue.use(ElementUI);
7
7
  Vue.use(Hiprint);
8
8
 
9
- Vue.use(OlCom);
9
+ Vue.use(OlCom, { method: "post" });
10
10
  swaggerInstall("http://220.179.249.140:20025/swagger/v1/swagger.json").then(() => {});
11
11
  new Vue({
12
12
  render: h => h(App),
@@ -288,7 +288,6 @@ export default {
288
288
  // 请求方式 post get
289
289
  method: {
290
290
  type: String,
291
- default: "get",
292
291
  },
293
292
  },
294
293
  data() {
@@ -317,6 +316,12 @@ export default {
317
316
  this.loadOptionSources();
318
317
  });
319
318
  },
319
+ computed: {
320
+ // 优先级:props > 全局配置 > 默认值
321
+ finalMethod() {
322
+ return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
323
+ },
324
+ },
320
325
  watch: {
321
326
  "formSearchData.value": {
322
327
  handler: function (newVal, OldVal) {
@@ -332,9 +337,9 @@ export default {
332
337
  },
333
338
  methods: {
334
339
  async init() {
335
- if (!this.isCustoms) {
340
+ if (!this.isCustoms && this.url) {
336
341
  const swaggerData = await getData();
337
- let swaggersearchColumns = swaggerData.paths[this.url][this.method].parameters || [];
342
+ let swaggersearchColumns = swaggerData.paths[this.url][this.finalMethod].parameters || [];
338
343
  if (typeof this.onSwagger === "function") {
339
344
  try {
340
345
  const res = await this.onSwagger({ columns: swaggersearchColumns });
@@ -219,11 +219,12 @@ const components = [
219
219
  OlPrint,
220
220
  OlPrintModel,
221
221
  ];
222
- const install = async function (Vue) {
222
+ const install = async function (Vue, options) {
223
223
  // 设置全局数据
224
224
  components.map(item => {
225
225
  Vue.component(`ol-${item.name}`, item);
226
226
  });
227
+ Vue.prototype.$olBaseConfig = options || {};
227
228
  consoleTooltip();
228
229
  };
229
230
 
@@ -443,7 +443,6 @@ export default {
443
443
  // 请求方式 post get
444
444
  method: {
445
445
  type: String,
446
- default: "get",
447
446
  },
448
447
  },
449
448
 
@@ -487,10 +486,14 @@ export default {
487
486
  });
488
487
  },
489
488
  },
489
+ // 优先级:props > 全局配置 > 默认值
490
+ finalMethod() {
491
+ return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
492
+ },
490
493
  },
491
494
  created() {
492
495
  // 通过swagger完善columns
493
- this.init();
496
+ if (this.url) this.init();
494
497
  },
495
498
  // 组件销毁时清理监听器
496
499
  beforeDestroy() {
@@ -502,8 +505,9 @@ export default {
502
505
  getData()
503
506
  .then(async swaggerData => {
504
507
  let swaggerColumns =
505
- swaggerData.paths[this.url][this.method].responses["200"].content["application/json"]
506
- .schema.properties.items.items.properties;
508
+ swaggerData.paths[this.url][this.finalMethod].responses["200"].content[
509
+ "application/json"
510
+ ].schema.properties.items.items.properties;
507
511
  if (typeof this.onSwagger === "function") {
508
512
  try {
509
513
  const res = await this.onSwagger({ columns: swaggerColumns });