(value)
| 57 | }, |
| 58 | |
| 59 | set(value) { |
| 60 | const emittedValue = options.set ? options.set(value) : value |
| 61 | if ( |
| 62 | !hasChanged(emittedValue, localValue) && |
| 63 | !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue)) |
| 64 | ) { |
| 65 | return |
| 66 | } |
| 67 | const rawProps = i.vnode!.props |
| 68 | const hasVModel = !!( |
| 69 | rawProps && |
| 70 | // check if parent has passed v-model |
| 71 | (name in rawProps || |
| 72 | camelizedName in rawProps || |
| 73 | hyphenatedName in rawProps) && |
| 74 | (`onUpdate:${name}` in rawProps || |
| 75 | `onUpdate:${camelizedName}` in rawProps || |
| 76 | `onUpdate:${hyphenatedName}` in rawProps) |
| 77 | ) |
| 78 | if (!hasVModel) { |
| 79 | // no v-model, local update |
| 80 | localValue = value |
| 81 | trigger() |
| 82 | } |
| 83 | |
| 84 | i.emit(`update:${name}`, emittedValue) |
| 85 | // #10279: if the local value is converted via a setter but the value |
| 86 | // emitted to parent was the same, the parent will not trigger any |
| 87 | // updates and there will be no prop sync. However the local input state |
| 88 | // may be out of sync, so we need to force an update here. |
| 89 | if ( |
| 90 | hasChanged(value, prevSetValue) && |
| 91 | ((hasChanged(value, emittedValue) && |
| 92 | !hasChanged(emittedValue, prevEmittedValue)) || |
| 93 | // #13524: browsers differ in when they flush microtasks between |
| 94 | // event listeners. If a v-model listener emits an intermediate value |
| 95 | // and a following listener restores the model to its previous prop |
| 96 | // value before parent updates are flushed, the parent render can be |
| 97 | // deduped as having no prop change. Force a local update so DOM state |
| 98 | // such as an input's value is synchronized back to the current model. |
| 99 | (hasVModel && |
| 100 | prevSetValue !== EMPTY_OBJ && |
| 101 | !hasChanged(emittedValue, localValue))) |
| 102 | ) { |
| 103 | trigger() |
| 104 | } |
| 105 | prevSetValue = value |
| 106 | prevEmittedValue = emittedValue |
| 107 | }, |
| 108 | } |
| 109 | }) |
| 110 |
nothing calls this directly
no test coverage detected