File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
platform/nativescript/compiler/modules Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { normalizeElementName } from '../../element-registry'
2
2
import { parseFor } from 'compiler/parser/index'
3
3
import { getAndRemoveAttr , addRawAttr } from 'compiler/helpers'
4
+ import { warn } from 'core/util/debug'
4
5
5
6
function preTransformNode ( el ) {
6
7
if ( normalizeElementName ( el . tag ) !== 'listview' ) {
7
8
return
8
9
}
9
- const exp = getAndRemoveAttr ( el , 'for' )
10
+
11
+ const vfor = getAndRemoveAttr ( el , 'v-for' )
12
+ delete el . attrsMap [ 'v-for' ]
13
+ if ( process . env . NODE_ENV !== 'production' && vfor ) {
14
+ warn (
15
+ `The v-for directive is not supported on a ${ el . tag } , ` +
16
+ 'Use the "for" attribute instead. For example, instead of ' +
17
+ `<${ el . tag } v-for="${ vfor } "> use <${ el . tag } for="${ vfor } ">.`
18
+ )
19
+ }
20
+
21
+ const exp = getAndRemoveAttr ( el , 'for' ) || vfor
10
22
if ( ! exp ) return
11
23
12
24
const res = parseFor ( exp )
13
- if ( ! res ) return
25
+ if ( ! res ) {
26
+ if ( process . env . NODE_ENV !== 'production' ) {
27
+ warn ( `Invalid for expression: ${ exp } ` )
28
+ }
29
+ return
30
+ }
14
31
15
32
addRawAttr ( el , ':items' , res . for )
16
33
addRawAttr ( el , '+alias' , res . alias )
You can’t perform that action at this time.
0 commit comments