diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index dd8d7dc68..6c86eadd0 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -58,7 +58,7 @@ const $props = defineProps({ default: 'flex-one', }, searchUrl: { - type: [String, Boolean], + type: String, default: 'table', }, isEditable: { diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 8585bf5bc..26160929c 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -2,7 +2,6 @@ import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useValidator } from 'src/composables/useValidator'; -import { useAttrs } from 'vue'; const emit = defineEmits([ 'update:modelValue', @@ -30,11 +29,10 @@ const $props = defineProps({ }, }); const { validations } = useValidator(); -const $attrs = useAttrs(); const { t } = useI18n(); -const requiredFieldRule = (val) => validations().required(isRequired.value, val); -const isRequired = computed(() => Object.keys($attrs).includes('required')); +const requiredFieldRule = (val) => validations().required($attrs.required, val); + const vnInputRef = ref(null); const value = computed({ get() { @@ -59,6 +57,12 @@ const focus = () => { vnInputRef.value.focus(); }; +defineExpose({ + focus, +}); +import { useAttrs } from 'vue'; +const $attrs = useAttrs(); + const mixinRules = [ requiredFieldRule, ...($attrs.rules ?? []), @@ -72,9 +76,6 @@ const mixinRules = [ } }, ]; -defineExpose({ - focus, -});