|
@@ -23,8 +23,8 @@ import {
|
|
|
import { camelize, extend, hyphenate, isArray, toNumber } from '@vue/shared'
|
|
import { camelize, extend, hyphenate, isArray, toNumber } from '@vue/shared'
|
|
|
import { hydrate, render } from '.'
|
|
import { hydrate, render } from '.'
|
|
|
|
|
|
|
|
-type VueElementConstructor<P = {}> = {
|
|
|
|
|
- new (): VueElement & P
|
|
|
|
|
|
|
+export type VueElementConstructor<P = {}> = {
|
|
|
|
|
+ new (initialProps?: Record<string, any>): VueElement & P
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// defineCustomElement provides the same type inference as defineComponent
|
|
// defineCustomElement provides the same type inference as defineComponent
|
|
@@ -134,8 +134,8 @@ export function defineCustomElement(
|
|
|
static get observedAttributes() {
|
|
static get observedAttributes() {
|
|
|
return attrKeys
|
|
return attrKeys
|
|
|
}
|
|
}
|
|
|
- constructor() {
|
|
|
|
|
- super(Comp, attrKeys, propKeys, hydate)
|
|
|
|
|
|
|
+ constructor(initialProps?: Record<string, any>) {
|
|
|
|
|
+ super(Comp, initialProps, attrKeys, propKeys, hydate)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -163,10 +163,6 @@ const BaseClass = (
|
|
|
) as typeof HTMLElement
|
|
) as typeof HTMLElement
|
|
|
|
|
|
|
|
export class VueElement extends BaseClass {
|
|
export class VueElement extends BaseClass {
|
|
|
- /**
|
|
|
|
|
- * @internal
|
|
|
|
|
- */
|
|
|
|
|
- _props: Record<string, any> = {}
|
|
|
|
|
/**
|
|
/**
|
|
|
* @internal
|
|
* @internal
|
|
|
*/
|
|
*/
|
|
@@ -178,6 +174,7 @@ export class VueElement extends BaseClass {
|
|
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
|
private _def: ComponentOptions & { styles?: string[] },
|
|
private _def: ComponentOptions & { styles?: string[] },
|
|
|
|
|
+ private _props: Record<string, any> = {},
|
|
|
private _attrKeys: string[],
|
|
private _attrKeys: string[],
|
|
|
private _propKeys: string[],
|
|
private _propKeys: string[],
|
|
|
hydrate?: RootHydrateFunction
|
|
hydrate?: RootHydrateFunction
|