Skip to content

Commit 037449f

Browse files
committed
ensure prop default value when instantiating without propsData (fix #3693)
1 parent 9566b33 commit 037449f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/core/instance/state.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export function initState (vm: Component) {
3232

3333
function initProps (vm: Component) {
3434
const props = vm.$options.props
35-
const propsData = vm.$options.propsData
3635
if (props) {
36+
const propsData = vm.$options.propsData || {}
3737
const keys = vm.$options._propKeys = Object.keys(props)
3838
const isRoot = !vm.$parent
3939
// root instance props should be converted

src/core/util/props.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ type PropOptions = {
1414
export function validateProp (
1515
key: string,
1616
propOptions: Object,
17-
propsData: ?Object,
17+
propsData: Object,
1818
vm?: Component
1919
): any {
20-
/* istanbul ignore if */
21-
if (!propsData) return
2220
const prop = propOptions[key]
2321
const absent = !hasOwn(propsData, key)
2422
let value = propsData[key]

0 commit comments

Comments
 (0)