fix(runtime-core): fix resolving assets from mixins and extends
fix #1963
This commit is contained in:
@@ -384,6 +384,9 @@ export function applyOptions(
|
||||
watch: watchOptions,
|
||||
provide: provideOptions,
|
||||
inject: injectOptions,
|
||||
// assets
|
||||
components,
|
||||
directives,
|
||||
// lifecycle
|
||||
beforeMount,
|
||||
mounted,
|
||||
@@ -568,6 +571,32 @@ export function applyOptions(
|
||||
}
|
||||
}
|
||||
|
||||
// asset options.
|
||||
// To reduce memory usage, only components with mixins or extends will have
|
||||
// resolved asset registry attached to instance.
|
||||
if (asMixin) {
|
||||
if (components) {
|
||||
extend(
|
||||
instance.components ||
|
||||
(instance.components = extend(
|
||||
{},
|
||||
(instance.type as ComponentOptions).components
|
||||
) as Record<string, ConcreteComponent>),
|
||||
components
|
||||
)
|
||||
}
|
||||
if (directives) {
|
||||
extend(
|
||||
instance.directives ||
|
||||
(instance.directives = extend(
|
||||
{},
|
||||
(instance.type as ComponentOptions).directives
|
||||
)),
|
||||
directives
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// lifecycle options
|
||||
if (!asMixin) {
|
||||
callSyncHook('created', options, publicThis, globalMixins)
|
||||
|
||||
Reference in New Issue
Block a user