File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,22 @@ export function collectDataFromConstructor (vm: Vue, Component: VueClass) {
66 // override _init to prevent to init as Vue instance
77 Component . prototype . _init = function ( this : Vue ) {
88 // proxy to actual vm
9- Object . getOwnPropertyNames ( vm ) . forEach ( key => {
10- Object . defineProperty ( this , key , {
11- get : ( ) => vm [ key ] ,
12- set : value => vm [ key ] = value
13- } )
9+ const keys = Object . getOwnPropertyNames ( vm )
10+ // 2.2.0 compat (props are no longer exposed as self properties)
11+ if ( vm . $options . props ) {
12+ for ( const key in vm . $options . props ) {
13+ if ( ! vm . hasOwnProperty ( key ) ) {
14+ keys . push ( key )
15+ }
16+ }
17+ }
18+ keys . forEach ( key => {
19+ if ( key . charAt ( 0 ) !== '_' ) {
20+ Object . defineProperty ( this , key , {
21+ get : ( ) => vm [ key ] ,
22+ set : value => vm [ key ] = value
23+ } )
24+ }
1425 } )
1526 }
1627
You can’t perform that action at this time.
0 commit comments