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

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

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

Loading…
Cancel
Save