8000 props: only warn twoWay when prop is present (fix #1400) · justnull/vue@d8862a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8862a1

Browse files
committed
props: only warn twoWay when prop is present (fix vuejs#1400)
1 parent 1a65e28 commit d8862a1

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/compiler/compile-props.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ module.exports = function compileProps (el, propOptions) {
8585
}
8686
}
8787
prop.parentPath = value
88+
89+
// warn required two-way
90+
if (
91+
process.env.NODE_ENV !== 'production' &&
92+
options.twoWay &&
93+
prop.mode !== propBindingModes.TWO_WAY
94+
) {
95+
_.warn(
96+
'Prop "' + name + '" expects a two-way binding type.'
97+
)
98+
}
99+
88100
} else if (options.required) {
89101
// warn missing required
90102
process.env.NODE_ENV !== 'production' && _.warn(
@@ -93,17 +105,6 @@ module.exports = function compileProps (el, propOptions) {
93105
}
94106
}
95107

96-
// warn required two-way
97-
if (
98-
process.env.NODE_ENV !== 'production' &&
99-
options.twoWay &&
100-
prop.mode !== propBindingModes.TWO_WAY
101-
) {
102-
_.warn(
103-
'Prop "' + name + '" expects a two-way binding type.'
104-
)
105-
}
106-
107108
// push prop
108109
props.push(prop)
109110
}

0 commit comments

Comments
 (0)
0