haiwei-ui 1.2.0 → 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haiwei-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "HaiWei前端组件库",
5
5
  "author": "Eric",
6
6
  "license": "ISC",
@@ -186,6 +186,24 @@
186
186
  },
187
187
  onExport() {
188
188
  this.$parent.triggerExport()
189
+ },
190
+ /** 设置输入框宽度 */
191
+ setInputWidths(formRef) {
192
+ if (!this.inputWidth || !formRef || !formRef.$el) return
193
+
194
+ let inputs = formRef.$el.querySelectorAll('.el-input__inner')
195
+ if (inputs) {
196
+ for (let i = 0; i < inputs.length; i++) {
197
+ const input = inputs[i]
198
+
199
+ // 检查是否有data-width属性,如果有则使用该值,否则使用inputWidth
200
+ const customWidth = input.getAttribute('data-width')
201
+
202
+ console.log('data-width============>1',customWidth)
203
+ input.style.width = customWidth || this.inputWidth
204
+ console.log('input.style.width==========>2',input.style.width)
205
+ }
206
+ }
189
207
  }
190
208
  },
191
209
  mounted() {
@@ -195,15 +213,19 @@
195
213
  this.query()
196
214
  }
197
215
  })
198
- if (this.inputWidth) {
199
- let inputs = this.$refs.normalForm.$el.querySelectorAll('.el-input__inner')
200
- if (inputs) {
201
- for (let i = 0; i < inputs.length; i++) {
202
- inputs[i].style.width = this.inputWidth
203
- }
204
- }
205
- }
216
+ // 设置普通查询栏输入框宽度
217
+ this.setInputWidths(this.$refs.normalForm)
206
218
  })
219
+ },
220
+ watch: {
221
+ showAdvanced(newVal) {
222
+ if (newVal && this.$refs.advancedForm) {
223
+ // 高级查询框显示时,设置其中的输入框宽度
224
+ this.$nextTick(() => {
225
+ this.setInputWidths(this.$refs.advancedForm)
226
+ })
227
+ }
228
+ }
207
229
  }
208
230
  }
209
231
  </script>