We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89d5bf0 commit 7580098Copy full SHA for 7580098
src/data.ts
@@ -4,6 +4,7 @@ import { noop, warn } from './util'
4
5
export function collectDataFromConstructor (vm: Vue, Component: VueClass<Vue>) {
6
// override _init to prevent to init as Vue instance
7
+ const originalInit = Component.prototype._init
8
Component.prototype._init = function (this: Vue) {
9
// proxy to actual vm
10
const keys = Object.getOwnPropertyNames(vm)
@@ -29,6 +30,9 @@ export function collectDataFromConstructor (vm: Vue, Component: VueClass<Vue>) {
29
30
// should be acquired class property values
31
const data = new Component()
32
33
+ // restore original _init to avoid memory leak (#209)
34
+ Component.prototype._init = originalInit
35
+
36
// create plain data object
37
const plainData = {}
38
Object.keys(data).forEach(key => {
0 commit comments