File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,23 @@ import {
1717
1818export default function ( Vue ) {
1919
20+ /**
21+ * Accessor for `$data` property, since setting $data
22+ * requires observing the new object and updating
23+ * proxied properties.
24+ */
25+
26+ Object . defineProperty ( Vue . prototype , '$data' , {
27+ get ( ) {
28+ return this . _data
29+ } ,
30+ set ( newData ) {
31+ if ( newData !== this . _data ) {
32+ this . _setData ( newData )
33+ }
34+ }
35+ } )
36+
2037 /**
2138 * Setup the scope of an instance, which contains:
2239 * - observed data
Original file line number Diff line number Diff line change @@ -24,20 +24,8 @@ import lifecycleAPI from './api/lifecycle'
2424 * @public
2525 */
2626
27- class Vue {
28- constructor ( options ) {
29- this . _init ( options )
30- }
31-
32- get $data ( ) {
33- return this . _data
34- }
35-
36- set $data ( newData ) {
37- if ( newData !== this . _data ) {
38- this . _setData ( newData )
39- }
40- }
27+ function Vue ( options ) {
28+ this . _init ( options )
4129}
4230
4331// install internals
You can’t perform that action at this time.
0 commit comments