fix(select): fix error style of select-dropdown (#838)

n

fix #812
This commit is contained in:
kooriookami 2020-12-05 07:46:58 -06:00 committed by GitHub
parent 4519575f73
commit ab76b845f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,15 +8,10 @@
</div>
</template>
<script lang="ts">
import {
computed,
onMounted,
inject,
} from 'vue'
import {
selectKey,
} from './token'
<script lang="ts">
import { computed, inject, onBeforeUnmount, onMounted, ref } from 'vue'
import { selectKey } from './token'
import { addResizeListener, removeResizeListener, ResizableElement } from '@element-plus/utils/resize-event'
export default {
name: 'ElSelectDropdown',
@ -29,11 +24,21 @@ export default {
// computed
const popperClass = computed(() => select.props.popperClass)
const isMultiple = computed(() => select.props.multiple)
const minWidth = computed(() => select.selectWrapper?.getBoundingClientRect().width + 'px')
const minWidth = ref('')
function updateMinWidth() {
minWidth.value = select.selectWrapper?.getBoundingClientRect().width + 'px'
}
onMounted(() => {
// TODO: updatePopper
// popper.value.update()
addResizeListener(select.selectWrapper as ResizableElement, updateMinWidth)
})
onBeforeUnmount(() => {
removeResizeListener(select.selectWrapper as ResizableElement, updateMinWidth)
})
return {