MCPcopy
hub / github.com/vuejs/core / constructor

Method constructor

packages/runtime-dom/src/apiCustomElement.ts:251–281  ·  view source on GitHub ↗
(
    /**
     * Component def - note this may be an AsyncWrapper, and this._def will
     * be overwritten by the inner component when resolved.
     */
    private _def: InnerComponentDef,
    private _props: Record<string, any> = {},
    private _createApp: CreateAppFunction<Element> = createApp,
  )

Source from the content-addressed store, hash-verified

249 private _slots?: Record<string, Node[]>
250
251 constructor(
252 /**
253 * Component def - note this may be an AsyncWrapper, and this._def will
254 * be overwritten by the inner component when resolved.
255 */
256 private _def: InnerComponentDef,
257 private _props: Record<string, any> = {},
258 private _createApp: CreateAppFunction<Element> = createApp,
259 ) {
260 super()
261 if (this.shadowRoot && _createApp !== createApp) {
262 this._root = this.shadowRoot
263 } else {
264 if (__DEV__ && this.shadowRoot) {
265 warn(
266 `Custom element has pre-rendered declarative shadow root but is not ` +
267 `defined as hydratable. Use \`defineSSRCustomElement\`.`,
268 )
269 }
270 if (_def.shadowRoot !== false) {
271 this.attachShadow(
272 extend({}, _def.shadowRootOptions, {
273 mode: 'open',
274 }) as ShadowRootInit,
275 )
276 this._root = this.shadowRoot!
277 } else {
278 this._root = this
279 }
280 }
281 }
282
283 connectedCallback(): void {
284 // avoid resolving component if it's not connected

Callers

nothing calls this directly

Calls 1

warnFunction · 0.90

Tested by

no test coverage detected