ol-base-components 3.3.8 → 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.8",
3
+ "version": "3.3.9",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
@@ -288,9 +288,6 @@ export default {
288
288
  // 请求方式 post get
289
289
  method: {
290
290
  type: String,
291
- default: () => {
292
- return this.$olBaseConfig.method || "get";
293
- },
294
291
  },
295
292
  },
296
293
  data() {
@@ -319,6 +316,12 @@ export default {
319
316
  this.loadOptionSources();
320
317
  });
321
318
  },
319
+ computed: {
320
+ // 优先级:props > 全局配置 > 默认值
321
+ finalMethod() {
322
+ return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
323
+ },
324
+ },
322
325
  watch: {
323
326
  "formSearchData.value": {
324
327
  handler: function (newVal, OldVal) {
@@ -336,7 +339,7 @@ export default {
336
339
  async init() {
337
340
  if (!this.isCustoms && this.url) {
338
341
  const swaggerData = await getData();
339
- let swaggersearchColumns = swaggerData.paths[this.url][this.method].parameters || [];
342
+ let swaggersearchColumns = swaggerData.paths[this.url][this.finalMethod].parameters || [];
340
343
  if (typeof this.onSwagger === "function") {
341
344
  try {
342
345
  const res = await this.onSwagger({ columns: swaggersearchColumns });
@@ -443,9 +443,6 @@ export default {
443
443
  // 请求方式 post get
444
444
  method: {
445
445
  type: String,
446
- default: () => {
447
- return this.$olBaseConfig.method || "get";
448
- },
449
446
  },
450
447
  },
451
448
 
@@ -489,6 +486,10 @@ export default {
489
486
  });
490
487
  },
491
488
  },
489
+ // 优先级:props > 全局配置 > 默认值
490
+ finalMethod() {
491
+ return this.method || (this.$olBaseConfig && this.$olBaseConfig.method) || "get";
492
+ },
492
493
  },
493
494
  created() {
494
495
  // 通过swagger完善columns
@@ -504,8 +505,9 @@ export default {
504
505
  getData()
505
506
  .then(async swaggerData => {
506
507
  let swaggerColumns =
507
- swaggerData.paths[this.url][this.method].responses["200"].content["application/json"]
508
- .schema.properties.items.items.properties;
508
+ swaggerData.paths[this.url][this.finalMethod].responses["200"].content[
509
+ "application/json"
510
+ ].schema.properties.items.items.properties;
509
511
  if (typeof this.onSwagger === "function") {
510
512
  try {
511
513
  const res = await this.onSwagger({ columns: swaggerColumns });