fix(v-on): refactor DOM event options modifer handling
fix #1567 Previously multiple `v-on` handlers with different event attach option modifers (`.once`, `.capture` and `.passive`) are generated as an array of objects in the form of `[{ handler, options }]` - however, this makes it pretty complex for `runtime-dom` to properly handle all possible value permutations, as each handler may need to be attached with different options. With this commit, they are now generated as event props with different keys - e.g. `v-on:click.capture` is now generated as a prop named `onClick.capture`. This allows them to be patched as separate props which makes the runtime handling much simpler.
This commit is contained in:
@@ -246,6 +246,8 @@ export interface ComponentInternalInstance {
|
||||
slots: InternalSlots
|
||||
refs: Data
|
||||
emit: EmitFn
|
||||
// used for keeping track of .once event handlers on components
|
||||
emitted: Record<string, boolean> | null
|
||||
|
||||
/**
|
||||
* setup related
|
||||
@@ -396,7 +398,8 @@ export function createComponentInstance(
|
||||
rtg: null,
|
||||
rtc: null,
|
||||
ec: null,
|
||||
emit: null as any // to be set immediately
|
||||
emit: null as any, // to be set immediately
|
||||
emitted: null
|
||||
}
|
||||
if (__DEV__) {
|
||||
instance.ctx = createRenderContext(instance)
|
||||
|
||||
Reference in New Issue
Block a user