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

Method _resolveProps

packages/runtime-dom/src/apiCustomElement.ts:466–488  ·  view source on GitHub ↗
(def: InnerComponentDef)

Source from the content-addressed store, hash-verified

464 }
465
466 private _resolveProps(def: InnerComponentDef) {
467 const { props } = def
468 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {})
469
470 // check if there are props set pre-upgrade or connect
471 for (const key of Object.keys(this)) {
472 if (key[0] !== '_' && declaredPropKeys.includes(key)) {
473 this._setProp(key, this[key as keyof this])
474 }
475 }
476
477 // defining getter/setters on prototype
478 for (const key of declaredPropKeys.map(camelize)) {
479 Object.defineProperty(this, key, {
480 get(this: VueElement) {
481 return this._getProp(key)
482 },
483 set(this: VueElement, val) {
484 this._setProp(key, val, true, !this._patching)
485 },
486 })
487 }
488 }
489
490 protected _setAttr(key: string): void {
491 if (key.startsWith('data-v-')) return

Callers 1

resolveMethod · 0.95

Calls 2

_setPropMethod · 0.95
mapMethod · 0.80

Tested by

no test coverage detected