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

Commitc94d04d

Browse files
committed
warn against incorrect propsData usage
1 parent9f6c23f commitc94d04d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

‎src/util/options.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ function guardArrayAssets (assets) {
325325
exportfunctionmergeOptions(parent,child,vm){
326326
guardComponents(child)
327327
guardProps(child)
328+
if(process.env.NODE_ENV!=='production'){
329+
if(child.propsData&&!vm){
330+
warn('propsData can only be used as an instantiation option.')
331+
}
332+
}
328333
varoptions={}
329334
varkey
330335
if(child.mixins){

‎test/unit/specs/directives/internal/prop_spec.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,15 @@ describe('prop', function () {
615615
expect(vm.a).toBe(123)
616616
})
617617

618+
it('should warn using propsData during extension',function(){
619+
Vue.extend({
620+
propsData:{
621+
a:123
622+
}
623+
})
624+
expect('propsData can only be used as an instantiation option').toHaveBeenWarned()
625+
})
626+
618627
it('should not warn for non-required, absent prop',function(){
619628
newVue({
620629
el:el,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp