File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,13 @@ export function processIf(
63
63
if ( siblings ) {
64
64
let i = siblings . length
65
65
while ( i -- ) {
66
- if ( siblings [ i ] . operation ) lastIfNode = siblings [ i ] . operation
66
+ if (
67
+ siblings [ i ] . operation &&
68
+ siblings [ i ] . operation ! . type === IRNodeTypes . IF
69
+ ) {
70
+ lastIfNode = siblings [ i ] . operation
71
+ break
72
+ }
67
73
}
68
74
}
69
75
Original file line number Diff line number Diff line change @@ -98,3 +98,23 @@ exports[`compiler: v-if > v-if + v-else-if 1`] = `
98
98
return n0
99
99
"
100
100
` ;
101
+
102
+ exports [` compiler: v-if > v-if + v-if / v-else[-if] 1` ] = `
103
+ "
104
+ const n8 = t3()
105
+ _setInsertionState(n8)
106
+ const n0 = _createIf(() => ("foo"), () => {
107
+ const n2 = t0 ()
108
+ return n2
109
+ } , null, true)
110
+ _setInsertionState(n8)
111
+ const n3 = _createIf(() => ("bar"), () => {
112
+ const n5 = t1 ()
113
+ return n5
114
+ } , () => {
115
+ const n7 = t2 ()
116
+ return n7
117
+ } , true)
118
+ return n8
119
+ "
120
+ ` ;
Original file line number Diff line number Diff line change @@ -213,6 +213,17 @@ describe('compiler: v-if', () => {
213
213
} )
214
214
} )
215
215
216
+ test ( 'v-if + v-if / v-else[-if]' , ( ) => {
217
+ const { code } = compileWithVIf (
218
+ `<div>
219
+ <span v-if="foo">foo</span>
220
+ <span v-if="bar">bar</span>
221
+ <span v-else>baz</span>
222
+ </div>` ,
223
+ )
224
+ expect ( code ) . toMatchSnapshot ( )
225
+ } )
226
+
216
227
test ( 'comment between branches' , ( ) => {
217
228
const { code, ir } = compileWithVIf (
218
229
`
You can’t perform that action at this time.
0 commit comments