Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commit71b4b25

Browse files
committed
fix: allow multiline expression in v-for
fixvuejs#7792
1 parentaf5453c commit71b4b25

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

‎src/compiler/parser/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121

2222
exportconstonRE=/^@|^v-on:/
2323
exportconstdirRE=/^v-|^@|^:/
24-
exportconstforAliasRE=/(.*?)\s+(?:in|of)\s+(.*)/
24+
exportconstforAliasRE=/([^]*?)\s+(?:in|of)\s+([^]*)/
2525
exportconstforIteratorRE=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/
2626
conststripParensRE=/^\(|\)$/g
2727

‎test/unit/features/directives/for.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,26 @@ describe('Directive v-for', () => {
464464
}).then(done)
465465
})
466466

467+
// #7792
468+
it('should work with multiline expressions',()=>{
469+
constvm=newVue({
470+
data:{
471+
a:[1],
472+
b:[2]
473+
},
474+
template:`
475+
<div>
476+
<span v-for="n in (
477+
a.concat(
478+
b
479+
)
480+
)">{{ n }}</span>
481+
</div>
482+
`
483+
}).$mount()
484+
expect(vm.$el.textContent).toBe('12')
485+
})
486+
467487
constsupportsDestructuring=(()=>{
468488
try{
469489
newFunction('var { foo } = bar')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp