web-component-gallery 2.2.28 → 2.2.31

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.
@@ -76,27 +76,34 @@ const DescriptionsList = {
76
76
 
77
77
  },
78
78
  mounted() {
79
- setTimeout(this.setDescContentWidth, 0)
79
+ this.setDescContentWidth()
80
80
  this.$bus.$onWindow(this, 'resize', this.setDescContentWidth)
81
81
  },
82
82
  methods: {
83
83
  setDescContentWidth() {
84
- const elementG = this.$refs.Descriptions.querySelectorAll('.ant-descriptions-item-content')
85
- const width = document.querySelector('.ant-descriptions-view').offsetWidth
86
- const labelWidth = document.querySelector('.ant-descriptions-item-label').offsetWidth
87
- const { column, descSettings } = this
88
- for (let i = 0; i < elementG.length; i++) {
89
- const contentWidth = (
90
- descSettings[i].span ?
91
- width * (descSettings[i].span / column) :
92
- width / column ) - labelWidth + 'px'
93
- const element = elementG[i]
94
- element.style = `
95
- width: ${contentWidth};
96
- min-width: ${contentWidth};
97
- max-width: ${contentWidth};
98
- `
84
+ const retry = () => {
85
+ const elementG = this.$refs.Descriptions.querySelectorAll('.ant-descriptions-item-content')
86
+ const width = document.querySelector('.ant-descriptions-view').offsetWidth
87
+ const labelWidth = document.querySelector('.ant-descriptions-item-label').offsetWidth
88
+ const { column, descSettings } = this
89
+ if (width === 0) {
90
+ setTimeout(retry, 100) // 重试间隔100ms
91
+ return
92
+ }
93
+ for (let i = 0; i < elementG.length; i++) {
94
+ const contentWidth = (
95
+ descSettings[i].span ?
96
+ width * (descSettings[i].span / column) :
97
+ width / column ) - labelWidth + 'px'
98
+ const element = elementG[i]
99
+ element.style = `
100
+ width: ${contentWidth};
101
+ min-width: ${contentWidth};
102
+ max-width: ${contentWidth};
103
+ `
104
+ }
99
105
  }
106
+ retry() // 初始调用
100
107
  }
101
108
  }
102
109
  }
@@ -55,13 +55,16 @@ export default {
55
55
  }
56
56
  },
57
57
  watch: {
58
- value(newVal, oldVal) {
59
- if (newVal.toString() === oldVal.toString()) return
60
- this.date = newVal
58
+ value: {
59
+ handler(newVal, oldVal) {
60
+ if (newVal.toString() === oldVal.toString()) return
61
+ this.date = [...newVal]
62
+ },
63
+ immediate: true
61
64
  },
62
- 'date.length': {
63
- handler(newLen) {
64
- this.$emit('update:rangePicker', newLen == 2 ? this.date : [])
65
+ date: {
66
+ handler(newVal) {
67
+ this.$emit('update:rangePicker', newVal.length === 2 ? [...newVal] : [])
65
68
  },
66
69
  deep: true
67
70
  }
@@ -72,7 +75,7 @@ export default {
72
75
  return {
73
76
  ...defaultConfig,
74
77
  placeholder: '开始日期',
75
- disabledDate: this.disabledStartDate,
78
+ // disabledDate: this.disabledStartDate,
76
79
  ...this.startConfig
77
80
  }
78
81
  },
@@ -81,7 +84,7 @@ export default {
81
84
  return {
82
85
  ...defaultConfig,
83
86
  placeholder: '结束日期',
84
- disabledDate: this.disabledEndDate,
87
+ // disabledDate: this.disabledEndDate,
85
88
  ...this.endConfig
86
89
  }
87
90
  }
@@ -103,10 +106,10 @@ export default {
103
106
  }
104
107
  const startDate = moment(startValue, this.startPickerAttrs.valueFormat)
105
108
  const endDate = moment(endValue, this.endPickerAttrs.valueFormat)
106
- return startDate.valueOf() >= endDate.valueOf()
109
+ return endDate.valueOf() < startDate.valueOf()
107
110
  },
108
111
  handleStartOpenChange(open) {
109
- if (!open) {
112
+ if (!open) {
110
113
  this.endOpen = true
111
114
  }
112
115
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-gallery",
3
- "version": "2.2.28",
3
+ "version": "2.2.31",
4
4
  "description": "基础vue、antdvue、less实现的私有组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "files": [