Browse Source

tweak v-model type=file warning phrasing

dev
Evan You 8 years ago
parent
commit
310f5a2f5f
  1. 3
      src/platforms/web/compiler/directives/model.js
  2. 2
      test/unit/features/directives/model-file.spec.js

3
src/platforms/web/compiler/directives/model.js

@ -114,8 +114,7 @@ function genDefaultModel (
type === 'file') {
warn(
`<${el.tag} v-model="${value}" type="file">:\n` +
'File inputs are read only. You should use @change instead:\n' +
`<${el.tag} @change="${value} = $event.target.files" type="file">`
`File inputs are read only. Use a v-on:change listener instead.`
)
}
addProp(el, 'value', isNative ? `_s(${value})` : `(${value})`)

2
test/unit/features/directives/model-file.spec.js

@ -8,6 +8,6 @@ describe('Directive v-model file', () => {
},
template: '<input v-model="file" type="file">'
}).$mount()
expect('use @change instead').toHaveBeenWarned()
expect('Use a v-on:change listener instead').toHaveBeenWarned()
})
})

Loading…
Cancel
Save