Subscribe on changes!

Short word for @update:model-value

avatar
Apr 28th 2023

What problem does this feature solve?

@update:model-value used many time and can be used instead of creating watch function so it will be pretty if their is short word instead of a long word. some suggestions 1-$u (as $ can be used as short syntax for v-model so we can add u character to it to inform as update $) 2-@$ 3-@::

What does the proposed API look like?

make syntax more clean with short code

avatar
Apr 28th 2023

#8018

I mean short word for @update:model-Value not v-model

avatar
Apr 28th 2023
<script lang="ts" setup>
const modelValue = defineModel<string>({ default: '' });
</script>

<template>
  <input v-model="modelValue" />
</template>
<script lang="ts" setup>
import { ref } from 'vue';

import TextField from '~/components/TextField.vue';

const val = ref('');
</script>

<template>
  <TextField v-model="val" />
  {{ val }}
</template>
avatar
Apr 28th 2023
<script lang="ts" setup>
const modelValue = defineModel<string>({ default: '' });
</script>

<template>
  <input v-model="modelValue" />
</template>
<script lang="ts" setup>
import { ref } from 'vue';

import TextField from '~/components/TextField.vue';

const val = ref('');
</script>

<template>
  <TextField v-model="val" />
  {{ val }}
</template>

Thank you but you have misconceptions about what i want. i will try describe in details You know in vue 3.3 new macros was released from this macros short v-model syntax you can write $ or :: instead of v-model okay. What i taking about is introduce short syntax also for update model event which triggered when model value changed to be @$ or @:: instead of @update:model-value.