Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
The "props" and "emits" attributes have been merged when creating component instances, so there is no need to merge them here. It's OK to directly reference the previously merged values
  • Loading branch information
ysy945 authored Oct 23, 2022
1 parent b0b74a1 commit 1a408b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/runtime-core/src/componentOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,8 @@ export function resolveMergedOptions(
if (isObject(base)) {
cache.set(base, resolved)
}
resolved.props = instance.propsOptions[0]
resolved.emits = instance.emits
return resolved
}

Expand Down Expand Up @@ -1000,6 +1002,8 @@ export function mergeOptions(
`"expose" option is ignored when declared in mixins or extends. ` +
`It should only be declared in the base component itself.`
)
} else if (key === "props" || key === "emits") {
continue
} else {
const strat = internalOptionMergeStrats[key] || (strats && strats[key])
to[key] = strat ? strat(to[key], from[key]) : from[key]
Expand All @@ -1010,8 +1014,6 @@ export function mergeOptions(

export const internalOptionMergeStrats: Record<string, Function> = {
data: mergeDataFn,
props: mergeObjectOptions, // TODO
emits: mergeObjectOptions, // TODO
// objects
methods: mergeObjectOptions,
computed: mergeObjectOptions,
Expand Down

0 comments on commit 1a408b0

Please sign in to comment.