fix(components): [select] not set input padding anymore (#7269)

This commit is contained in:
Zhongxiang Wang 2022-04-20 17:01:29 +08:00 committed by GitHub
parent 1ebafe7bbe
commit de29873f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -543,27 +543,16 @@ export default defineComponent({
resetInputHeight()
}
nextTick(() => {
if (!reference.value) return
if (reference.value.$el) {
inputWidth.value = reference.value.$el.getBoundingClientRect().width
}
const refEl = reference.value && reference.value.$el
if (!refEl) return
inputWidth.value = refEl.getBoundingClientRect().width
if (ctx.slots.prefix) {
const inputChildNodes = reference.value.$el.childNodes
const input = (Array.from(inputChildNodes) as HTMLElement[]).find(
(item) => item.tagName === 'INPUT'
const prefix = refEl.querySelector(`.${nsInput.e('prefix')}`)
prefixWidth.value = Math.max(
prefix.getBoundingClientRect().width + 5,
30
)
if (input) {
const prefix = reference.value.$el.querySelector(
`.${nsInput.e('prefix')}`
)
prefixWidth.value = Math.max(
prefix.getBoundingClientRect().width + 5,
30
)
if (states.prefixWidth) {
input.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`
}
}
}
})
setSelected()