|
@@ -28,14 +28,14 @@ export function useModel(
|
|
|
return ref() as any
|
|
return ref() as any
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (__DEV__ && !(i.propsOptions[0] as NormalizedProps)[name]) {
|
|
|
|
|
|
|
+ const camelizedName = camelize(name)
|
|
|
|
|
+ if (__DEV__ && !(i.propsOptions[0] as NormalizedProps)[camelizedName]) {
|
|
|
warn(`useModel() called with prop "${name}" which is not declared.`)
|
|
warn(`useModel() called with prop "${name}" which is not declared.`)
|
|
|
return ref() as any
|
|
return ref() as any
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const camelizedName = camelize(name)
|
|
|
|
|
const hyphenatedName = hyphenate(name)
|
|
const hyphenatedName = hyphenate(name)
|
|
|
- const modifiers = getModelModifiers(props, name)
|
|
|
|
|
|
|
+ const modifiers = getModelModifiers(props, camelizedName)
|
|
|
|
|
|
|
|
const res = customRef((track, trigger) => {
|
|
const res = customRef((track, trigger) => {
|
|
|
let localValue: any
|
|
let localValue: any
|
|
@@ -43,7 +43,7 @@ export function useModel(
|
|
|
let prevEmittedValue: any
|
|
let prevEmittedValue: any
|
|
|
|
|
|
|
|
watchSyncEffect(() => {
|
|
watchSyncEffect(() => {
|
|
|
- const propValue = props[name]
|
|
|
|
|
|
|
+ const propValue = props[camelizedName]
|
|
|
if (hasChanged(localValue, propValue)) {
|
|
if (hasChanged(localValue, propValue)) {
|
|
|
localValue = propValue
|
|
localValue = propValue
|
|
|
trigger()
|
|
trigger()
|