Skip to content

Commit

Permalink
fix: support customElementOptions继承
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchangtao committed Nov 21, 2024
1 parent 6eb29d3 commit 65a9acd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/runtime-dom/src/apiCustomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function defineCustomElement(
class VueCustomElement extends VueElement {
static def = Comp
constructor(initialProps?: Record<string, any>) {
super(Comp, initialProps, _createApp)
super(Comp, initialProps, extraOptions, _createApp)
}
}

Expand Down Expand Up @@ -250,6 +250,7 @@ export class VueElement
*/
private _def: InnerComponentDef,
private _props: Record<string, any> = {},
private _extraOptions: ComponentOptions = {},
private _createApp: CreateAppFunction<Element> = createApp,
) {
super()
Expand Down Expand Up @@ -403,9 +404,12 @@ export class VueElement

const asyncDef = (this._def as ComponentOptions).__asyncLoader
if (asyncDef) {
this._pendingResolve = asyncDef().then(def =>
resolve((this._def = def), true),
)
this._pendingResolve = asyncDef().then(def => {
if (isPlainObject(def)) {
extend(def, this._extraOptions)
}
return resolve((this._def = def), true)
})
} else {
resolve(this._def)
}
Expand Down

0 comments on commit 65a9acd

Please sign in to comment.