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

Function getComponentPublicInstance

packages/runtime-core/src/component.ts:1189–1211  ·  view source on GitHub ↗
(
  instance: ComponentInternalInstance,
)

Source from the content-addressed store, hash-verified

1187}
1188
1189export function getComponentPublicInstance(
1190 instance: ComponentInternalInstance,
1191): ComponentPublicInstance | ComponentInternalInstance['exposed'] | null {
1192 if (instance.exposed) {
1193 return (
1194 instance.exposeProxy ||
1195 (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
1196 get(target, key: string) {
1197 if (key in target) {
1198 return target[key]
1199 } else if (key in publicPropertiesMap) {
1200 return publicPropertiesMap[key](instance)
1201 }
1202 },
1203 has(target, key: string) {
1204 return key in target || key in publicPropertiesMap
1205 },
1206 }))
1207 )
1208 } else {
1209 return instance.proxy
1210 }
1211}
1212
1213const classifyRE = /(?:^|[-_])\w/g
1214const classify = (str: string): string =>

Callers 4

mountFunction · 0.90
getPublicInstanceFunction · 0.90
setRefFunction · 0.90
withDirectivesFunction · 0.90

Calls 2

proxyRefsFunction · 0.90
markRawFunction · 0.90

Tested by

no test coverage detected