feat: use composable to unify logic

This commit is contained in:
Javier Segarra 2024-10-30 08:29:04 +01:00
parent 4de23c31b3
commit 1761cc23e0
3 changed files with 3 additions and 3 deletions

View File

@ -6,9 +6,9 @@ import { useAttrs } from 'vue';
import VnDate from './VnDate.vue'; import VnDate from './VnDate.vue';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';
const $attrs = useAttrs();
const { isRequired, requiredFieldRule } = useRequired($attrs); const { isRequired, requiredFieldRule } = useRequired($attrs);
const model = defineModel({ type: [String, Date] }); const model = defineModel({ type: [String, Date] });
const $attrs = useAttrs();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({

View File

@ -5,9 +5,9 @@ import { date } from 'quasar';
import VnTime from './VnTime.vue'; import VnTime from './VnTime.vue';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';
const $attrs = useAttrs();
const { isRequired, requiredFieldRule } = useRequired($attrs); const { isRequired, requiredFieldRule } = useRequired($attrs);
const { t } = useI18n(); const { t } = useI18n();
const $attrs = useAttrs();
const model = defineModel({ type: String }); const model = defineModel({ type: String });
const props = defineProps({ const props = defineProps({
timeOnly: { timeOnly: {

View File

@ -7,8 +7,8 @@ import { useAttrs } from 'vue';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';
const { t } = useI18n(); const { t } = useI18n();
const emit = defineEmits(['update:model-value', 'update:options']); const emit = defineEmits(['update:model-value', 'update:options']);
const { isRequired, requiredFieldRule } = useRequired($attrs);
const $attrs = useAttrs(); const $attrs = useAttrs();
const { isRequired, requiredFieldRule } = useRequired($attrs);
const props = defineProps({ const props = defineProps({
location: { location: {
type: Object, type: Object,