refactor: refs #8409 use defineModel instead or defineProps
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-01-29 11:58:19 +01:00
parent 3aa8acf02a
commit 613ebc0eb4
1 changed files with 3 additions and 9 deletions

View File

@ -2,17 +2,11 @@
import { computed } from 'vue'; import { computed } from 'vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
const emit = defineEmits(['update:modelValue']); const model = defineModel({ type: [String, Number, Object] });
const $props = defineProps({
modelValue: {
type: [String, Number, Object],
default: null,
},
});
const url = 'Suppliers'; const url = 'Suppliers';
const value = computed({ const value = computed({
get() { get() {
return $props.modelValue; return model;
}, },
set(val) { set(val) {
emit('update:modelValue', val); emit('update:modelValue', val);
@ -24,7 +18,7 @@ const value = computed({
<VnSelect <VnSelect
:label="$t('globals.supplier')" :label="$t('globals.supplier')"
v-bind="$attrs" v-bind="$attrs"
v-model="value" v-model="model"
:url="url" :url="url"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"