feat: 优化选择器组件获取元素并渲染

main
wu.jian2 2 years ago
parent 125a15ff35
commit 6ea0516008

@ -146,6 +146,7 @@ export default {
selectDropdownIcon.style.fontSize = config.customize.fontSize + 'px'
//
const selectDropdownEl = document.querySelector(`.select-${config.code} .el-select-dropdown`)
console.log('selectDropdownEl', selectDropdownEl)
//
if (selectDropdownEl) {
//
@ -169,12 +170,9 @@ export default {
selectDropdownEmptyEl.style.backgroundColor = this.innerConfig.customize.dropDownBackgroundColor
}
// hover
const selectDropdownItemEl = document.querySelectorAll(`.select-popper-${this.innerConfig.code} .el-select-dropdown__item`)
// --dropDownHoverFontColor --dropDownHoverBackgroundColor
selectDropdownItemEl.forEach(item => {
item.style.setProperty('--dropDownHoverFontColor', this.innerConfig.customize.dropDownHoverFontColor)
item.style.setProperty('--dropDownHoverBackgroundColor', this.innerConfig.customize.dropDownHoverBackgroundColor)
})
const selectDropdownWrap = document.querySelector(`.select-popper-${this.innerConfig.code} .el-select-dropdown__wrap`)
selectDropdownWrap.style.setProperty('--dropDownHoverFontColor', this.innerConfig.customize.dropDownHoverFontColor)
selectDropdownWrap.style.setProperty('--dropDownHoverBackgroundColor', this.innerConfig.customize.dropDownHoverBackgroundColor)
}
// 使
const selectDropdownItemEl = document.querySelectorAll(`.select-popper-${this.innerConfig.code} .el-select-dropdown__item`)

Loading…
Cancel
Save