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

Function formatInstance

packages/runtime-core/src/customFormatter.ts:86–119  ·  view source on GitHub ↗
(instance: ComponentInternalInstance)

Source from the content-addressed store, hash-verified

84 }
85
86 function formatInstance(instance: ComponentInternalInstance) {
87 const blocks = []
88 if (instance.type.props && instance.props) {
89 blocks.push(createInstanceBlock('props', toRaw(instance.props)))
90 }
91 if (instance.setupState !== EMPTY_OBJ) {
92 blocks.push(createInstanceBlock('setup', instance.setupState))
93 }
94 if (instance.data !== EMPTY_OBJ) {
95 blocks.push(createInstanceBlock('data', toRaw(instance.data)))
96 }
97 const computed = extractKeys(instance, 'computed')
98 if (computed) {
99 blocks.push(createInstanceBlock('computed', computed))
100 }
101 const injected = extractKeys(instance, 'inject')
102 if (injected) {
103 blocks.push(createInstanceBlock('injected', injected))
104 }
105
106 blocks.push([
107 'div',
108 {},
109 [
110 'span',
111 {
112 style: keywordStyle.style + ';opacity:0.66',
113 },
114 '$ (internal): ',
115 ],
116 ['object', { object: instance }],
117 ])
118 return blocks
119 }
120
121 function createInstanceBlock(type: string, target: any) {
122 target = extend({}, target)

Callers 1

bodyFunction · 0.85

Calls 4

toRawFunction · 0.90
createInstanceBlockFunction · 0.85
extractKeysFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected