Browse Source

Merge 1b1441e04a into df014ae709

pull/8332/merge
ming4762 3 weeks ago
committed by GitHub
parent
commit
56e22ac237
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 26
      packages/effects/common-ui/src/components/icon-picker/icon-picker.vue

26
packages/effects/common-ui/src/components/icon-picker/icon-picker.vue

@ -1,7 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { IconPickerProps } from './types'; import type { IconPickerProps } from './types';
import { computed, ref, useAttrs, watch, watchEffect } from 'vue'; import {
computed,
onBeforeUpdate,
ref,
useAttrs,
watch,
watchEffect,
} from 'vue';
import { usePagination } from '@vben/hooks'; import { usePagination } from '@vben/hooks';
import { EmptyIcon, Grip, listIcons } from '@vben/icons'; import { EmptyIcon, Grip, listIcons } from '@vben/icons';
@ -100,7 +107,17 @@ const { paginationList, total, setCurrentPage, currentPage } = usePagination(
); );
watchEffect(() => { watchEffect(() => {
currentSelect.value = modelValue.value; currentSelect.value =
props.modelValueProp === 'modelValue'
? modelValue.value
: ((attrs[props.modelValueProp] as string) ?? '');
});
onBeforeUpdate(() => {
if (props.modelValueProp !== 'modelValue') {
currentSelect.value =
(attrs[props.modelValueProp] as string | undefined) ?? '';
}
}); });
watch( watch(
@ -155,7 +172,10 @@ function updateCurrentSelect(v: string) {
} }
} }
const getBindAttrs = computed(() => { const getBindAttrs = computed(() => {
return objectOmit(attrs, [`onUpdate:${props.modelValueProp}`]); return objectOmit(attrs, [
`onUpdate:${props.modelValueProp}`,
props.modelValueProp,
]);
}); });
defineExpose({ toggleOpenState, open, close }); defineExpose({ toggleOpenState, open, close });

Loading…
Cancel
Save