Skip to content

Commit

Permalink
fix: 修复select下拉选项宽度问题 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun committed Mar 24, 2022
1 parent 2e5cf95 commit e27420c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/select/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import {
onMounted,
CSSProperties,
defineComponent,
nextTick,
} from 'vue';
import getPrefixCls from '../_util/getPrefixCls';
import { useTheme } from '../_theme/useTheme';
Expand Down Expand Up @@ -112,8 +111,14 @@ export default defineComponent({
? useArrayModel(props, emit)
: useNormalModel(props, emit);
const triggerRef = ref();
const triggerWidth = ref(0);
watch(isOpenedRef, () => {
emit('visibleChange', unref(isOpenedRef));
if (isOpenedRef.value && triggerRef.value) {
triggerWidth.value = triggerRef.value.$el.offsetWidth;
}
});
const handleChange = () => {
Expand Down Expand Up @@ -296,9 +301,6 @@ export default defineComponent({
}
};
const triggerRef = ref();
const triggerWidth = ref(0);
onMounted(() => {
if (triggerRef.value) {
triggerWidth.value = triggerRef.value.$el.offsetWidth;
Expand Down

0 comments on commit e27420c

Please sign in to comment.