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

Function expose

packages/runtime-core/src/component.ts:1135–1157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133 instance: ComponentInternalInstance,
1134): SetupContext {
1135 const expose: SetupContext['expose'] = exposed => {
1136 if (__DEV__) {
1137 if (instance.exposed) {
1138 warn(`expose() should be called only once per setup().`)
1139 }
1140 if (exposed != null) {
1141 let exposedType: string = typeof exposed
1142 if (exposedType === 'object') {
1143 if (isArray(exposed)) {
1144 exposedType = 'array'
1145 } else if (isRef(exposed)) {
1146 exposedType = 'ref'
1147 }
1148 }
1149 if (exposedType !== 'object') {
1150 warn(
1151 `expose() should be passed a plain object, received ${exposedType}.`,
1152 )
1153 }
1154 }
1155 }
1156 instance.exposed = exposed || {}
1157 }
1158
1159 if (__DEV__) {
1160 // We use getters in dev in case libs like test-utils overwrite instance

Callers 6

setupFunction · 0.85
setupFunction · 0.85
setupFunction · 0.85
setupFunction · 0.85
setupFunction · 0.85
setupFunction · 0.85

Calls 2

warnFunction · 0.90
isRefFunction · 0.90

Tested by 6

setupFunction · 0.68
setupFunction · 0.68
setupFunction · 0.68
setupFunction · 0.68
setupFunction · 0.68
setupFunction · 0.68