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

Function defineCustomElement

packages/runtime-dom/src/apiCustomElement.ts:168–186  ·  view source on GitHub ↗
(
  options: any,
  extraOptions?: ComponentOptions,
  /**
   * @internal
   */
  _createApp?: CreateAppFunction<Element>,
)

Source from the content-addressed store, hash-verified

166
167/*@__NO_SIDE_EFFECTS__*/
168export function defineCustomElement(
169 options: any,
170 extraOptions?: ComponentOptions,
171 /**
172 * @internal
173 */
174 _createApp?: CreateAppFunction<Element>,
175): VueElementConstructor {
176 let Comp = defineComponent(options, extraOptions) as any
177 if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions)
178 class VueCustomElement extends VueElement {
179 static def = Comp
180 constructor(initialProps?: Record<string, any>) {
181 super(Comp, initialProps, _createApp)
182 }
183 }
184
185 return VueCustomElement
186}
187
188/*@__NO_SIDE_EFFECTS__*/
189export const defineSSRCustomElement = ((

Calls 2

defineComponentFunction · 0.90
isPlainObjectFunction · 0.90

Tested by

no test coverage detected