-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.js
79 lines (64 loc) · 1.39 KB
/
vue.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var extend = require('./util').extend
/**
* The exposed Vue constructor.
*
* API conventions:
* - public API methods/properties are prefiexed with `$`
* - internal methods/properties are prefixed with `_`
* - non-prefixed properties are assumed to be proxied user data.
*
* @constructor
* @param {Object} [options]
* @public
*/
function Vue (options) {
this._init(options)
}
/**
* Build up the prototype
*/
var p = Vue.prototype
/**
* The $root recursively points to the root instance.
*
* @readonly
*/
Object.defineProperty(p, '$root', {
get: function () {
return this.$parent
? this.$parent.$root
: this
}
})
/**
* $data has a setter which does a bunch of teardown/setup work
*/
Object.defineProperty(p, '$data', {
get: function () {
return this._data
},
set: function (newData) {
this._initData(newData)
}
})
/**
* Mixin internal instance methods
*/
extend(p, require('./instance/init'))
extend(p, require('./instance/events'))
extend(p, require('./instance/data'))
extend(p, require('./instance/bindings'))
extend(p, require('./instance/element'))
extend(p, require('./instance/compile'))
/**
* Mixin public API methods
*/
extend(p, require('./api/data'))
extend(p, require('./api/dom'))
extend(p, require('./api/events'))
extend(p, require('./api/lifecycle'))
/**
* Mixin global API
*/
extend(Vue, require('./api/global'))
module.exports = Vue