1
1
// Vitest Snapshot v1
2
2
3
+ exports [` sfc props transform > $$() escape 1` ] = `
4
+ "import { toRef as _toRef } from 'vue'
5
+
6
+ export default {
7
+ props : [' foo' ],
8
+ setup (__props ) {
9
+ const __props_bar = _toRef(__props , 'bar ');
10
+ const __props_foo = _toRef(__props , 'foo ');
11
+
12
+
13
+ console.log((__props_foo ))
14
+ console.log((__props_bar ))
15
+ ;({ foo : __props_foo , baz : __props_bar })
16
+
17
+ return () => {}
18
+ }
19
+
20
+ } "
21
+ ` ;
22
+
23
+ exports [` sfc props transform > aliasing 1` ] = `
24
+ "import { toDisplayString as _toDisplayString } from \\ "vue\\ "
25
+
26
+
27
+ export default {
28
+ props : [' foo' ],
29
+ setup (__props ) {
30
+
31
+
32
+ let x = foo
33
+ let y = __props.foo
34
+
35
+ return (_ctx , _cache ) => {
36
+ return _toDisplayString (__props .foo + __props .foo )
37
+ }
38
+ }
39
+
40
+ } "
41
+ ` ;
42
+
43
+ exports [` sfc props transform > basic usage 1` ] = `
44
+ "import { toDisplayString as _toDisplayString } from \\ "vue\\ "
45
+
46
+
47
+ export default {
48
+ props : [' foo' ],
49
+ setup (__props ) {
50
+
51
+
52
+ console.log(__props .foo )
53
+
54
+ return (_ctx , _cache ) => {
55
+ return _toDisplayString (__props .foo )
56
+ }
57
+ }
58
+
59
+ } "
60
+ ` ;
61
+
62
+ exports [` sfc props transform > computed static key 1` ] = `
63
+ "import { toDisplayString as _toDisplayString } from \\ "vue\\ "
64
+
65
+
66
+ export default {
67
+ props : [' foo' ],
68
+ setup (__props ) {
69
+
70
+
71
+ console.log(__props .foo )
72
+
73
+ return (_ctx , _cache ) => {
74
+ return _toDisplayString (__props .foo )
75
+ }
76
+ }
77
+
78
+ } "
79
+ ` ;
80
+
81
+ exports [` sfc props transform > default values w/ runtime declaration 1` ] = `
82
+ "import { mergeDefaults as _mergeDefaults } from 'vue'
83
+
84
+ export default {
85
+ props : _mergeDefaults ([' foo' , ' bar' ], {
86
+ foo: 1 ,
87
+ bar : () => ({})
88
+ }),
89
+ setup (__props ) {
90
+
91
+
92
+
93
+ return () => {}
94
+ }
95
+
96
+ } "
97
+ ` ;
98
+
3
99
exports [` sfc props transform > default values w/ type declaration & key is string 1` ] = `
4
100
"import { defineComponent as _defineComponent } from 'vue'
5
101
@@ -16,3 +112,114 @@ return () => {}
16
112
17
113
} )"
18
114
` ;
115
+
116
+ exports [` sfc props transform > default values w/ type declaration 1` ] = `
117
+ "import { defineComponent as _defineComponent } from 'vue'
118
+
119
+ export default /*#__PURE__*/_defineComponent({
120
+ props : {
121
+ foo: { type: Number , required: false , default: 1 },
122
+ bar: { type: Object , required: false , default : () => ({}) }
123
+ },
124
+ setup (__props : any ) {
125
+
126
+
127
+
128
+ return () => {}
129
+ }
130
+
131
+ } )"
132
+ ` ;
133
+
134
+ exports [` sfc props transform > default values w/ type declaration, prod mode 1` ] = `
135
+ "import { defineComponent as _defineComponent } from 'vue'
136
+
137
+ export default /*#__PURE__*/_defineComponent({
138
+ props : {
139
+ foo: { default: 1 },
140
+ bar: { default : () => ({}) },
141
+ baz: null ,
142
+ boola: { type: Boolean },
143
+ boolb: { type: [Boolean , Number ] },
144
+ func: { type: Function , default : () => (() => {}) }
145
+ },
146
+ setup (__props : any ) {
147
+
148
+
149
+
150
+ return () => {}
151
+ }
152
+
153
+ } )"
154
+ ` ;
155
+
156
+ exports [` sfc props transform > multiple variable declarations 1` ] = `
157
+ "import { toDisplayString as _toDisplayString , openBlock as _openBlock , createElementBlock as _createElementBlock } from \\ "vue\\ "
158
+
159
+
160
+ export default {
161
+ props : [' foo' ],
162
+ setup (__props ) {
163
+
164
+ const bar = 'fish', hello = 'world'
165
+
166
+ return (_ctx , _cache ) => {
167
+ return (_openBlock (), _createElementBlock (\\" div\\ " , null , _toDisplayString (__props .foo ) + \\" \\ " + _toDisplayString (hello ) + \\" \\ " + _toDisplayString (bar ), 1 /* TEXT */ ))
168
+ }
169
+ }
170
+
171
+ } "
172
+ ` ;
173
+
174
+ exports [` sfc props transform > nested scope 1` ] = `
175
+ "export default {
176
+ props : [' foo' , ' bar' ],
177
+ setup (__props ) {
178
+
179
+
180
+ function test(foo ) {
181
+ console .log (foo )
182
+ console .log (__props .bar )
183
+ }
184
+
185
+ return () => {}
186
+ }
187
+
188
+ } "
189
+ ` ;
190
+
191
+ exports [` sfc props transform > non-identifier prop names 1` ] = `
192
+ "import { toDisplayString as _toDisplayString } from \\ "vue\\ "
193
+
194
+
195
+ export default {
196
+ props : { ' foo.bar' : Function },
197
+ setup (__props ) {
198
+
199
+
200
+ let x = __props[\\"foo.bar\\"]
201
+
202
+ return (_ctx , _cache ) => {
203
+ return _toDisplayString (__props [\\" foo.bar\\ " ])
204
+ }
205
+ }
206
+
207
+ } "
208
+ ` ;
209
+
210
+ exports [` sfc props transform > rest spread 1` ] = `
211
+ "import { createPropsRestProxy as _createPropsRestProxy } from 'vue'
212
+
213
+ export default {
214
+ props : [' foo' , ' bar' , ' baz' ],
215
+ setup (__props ) {
216
+
217
+ const rest = _createPropsRestProxy(__props , [\\"foo \\",\\"bar \\"]);
218
+
219
+
220
+
221
+ return () => {}
222
+ }
223
+
224
+ } "
225
+ ` ;
0 commit comments