vueuse / vueuse

Collection of essential Vue Composition Utilities for Vue 2 and 3

Home Page:https://vueuse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useVModel hold internal state

ftcopilot017 opened this issue · comments

Clear and concise description of the problem

#622

Currently getValue in useVModel will always return undefined when props[key] and defaultValue is undefined

const getValue = () => isDef(props[key!])
? cloneFn(props[key!])
: defaultValue

Maybe it's not a common practice in real world? Just like antd Input component https://next.antdv.com/components/input, if you don't pass value(v-model), the Input component will hold it's internal value. This means you can type any value without manually set v-model:value. But if using useVModel, you can't typing anything unless set v-model:value="xxx".

Suggested solution

If this feature is reasonable. Maybe we could add interanl option in useVModel options for compatibility.

Alternative

No response

Additional context

No response

Validations