vuejs 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/vuejs/version.rb +1 -1
- data/vendor/assets/javascripts/vue2.js +603 -456
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fa23b8cab0da4e43e4f1612dcc4d3f3ad679f33
|
4
|
+
data.tar.gz: f006633d5db58048e5112ceaf94fffdef5b05592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 370919533736893068ed8b22f58791731144d4aadcbc3e349cbe5e37fad186d1ea2d86d202c39a43e1c4160eb661a786207d1fc5cd544f2b4b58975d2937b228
|
7
|
+
data.tar.gz: e51c32ed559dcc782bd8d59d005898c18dc9780ab3a017aa2d5e85f600ba04adcf734571f9d7fc74bedd0bb9d7cb946779e0888b96521188bae77050ca31e29a
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
gem `vuejs` ships with the 1.x & 2.x latest [Vue.js + vue-router + vue-resource + vue-validator + vuex](http://vuejs.org/) and integrate with Rails' asset pipeline. Vue.js is created by Evan You and the vuejs team.
|
6
6
|
|
7
|
-
The current 2.x version is `Vue.js` (v2.1.
|
7
|
+
The current 2.x version is `Vue.js` (v2.1.7) + `vue-router` (v2.1.1) + `vue-validator` (v2.1.3) + `vuex` (v2.1.1).
|
8
8
|
> Note that Vue 2.x is not compatible with 1.x. vue-router 2.0 only works with Vue 2.x`
|
9
9
|
|
10
10
|
##### Legacy
|
@@ -12,8 +12,6 @@ The current 1.x version is `Vue.js` (v1.0.28) + `vue-router` (v0.7.13) + `vue-re
|
|
12
12
|
|
13
13
|
# Requirement
|
14
14
|
|
15
|
-
|
16
|
-
|
17
15
|
## Installation
|
18
16
|
|
19
17
|
Add this line to your application's Gemfile:
|
data/lib/vuejs/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Vue.js v2.1.
|
2
|
+
* Vue.js v2.1.7
|
3
3
|
* (c) 2014-2016 Evan You
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
@@ -219,13 +219,15 @@ function genStaticKeys (modules) {
|
|
219
219
|
* if they are plain objects, do they have the same shape?
|
220
220
|
*/
|
221
221
|
function looseEqual (a, b) {
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
222
|
+
var isObjectA = isObject(a);
|
223
|
+
var isObjectB = isObject(b);
|
224
|
+
if (isObjectA && isObjectB) {
|
225
|
+
return JSON.stringify(a) === JSON.stringify(b)
|
226
|
+
} else if (!isObjectA && !isObjectB) {
|
227
|
+
return String(a) === String(b)
|
228
|
+
} else {
|
229
|
+
return false
|
230
|
+
}
|
229
231
|
}
|
230
232
|
|
231
233
|
function looseIndexOf (arr, val) {
|
@@ -261,7 +263,7 @@ var config = {
|
|
261
263
|
/**
|
262
264
|
* Ignore certain custom elements
|
263
265
|
*/
|
264
|
-
ignoredElements:
|
266
|
+
ignoredElements: [],
|
265
267
|
|
266
268
|
/**
|
267
269
|
* Custom user key aliases for v-on
|
@@ -734,7 +736,7 @@ function copyAugment (target, src, keys) {
|
|
734
736
|
* returns the new observer if successfully observed,
|
735
737
|
* or the existing observer if the value already has one.
|
736
738
|
*/
|
737
|
-
function observe (value) {
|
739
|
+
function observe (value, asRootData) {
|
738
740
|
if (!isObject(value)) {
|
739
741
|
return
|
740
742
|
}
|
@@ -750,6 +752,9 @@ function observe (value) {
|
|
750
752
|
) {
|
751
753
|
ob = new Observer(value);
|
752
754
|
}
|
755
|
+
if (asRootData && ob) {
|
756
|
+
ob.vmCount++;
|
757
|
+
}
|
753
758
|
return ob
|
754
759
|
}
|
755
760
|
|
@@ -1216,10 +1221,10 @@ function validateProp (
|
|
1216
1221
|
var absent = !hasOwn(propsData, key);
|
1217
1222
|
var value = propsData[key];
|
1218
1223
|
// handle boolean props
|
1219
|
-
if (
|
1224
|
+
if (isType(Boolean, prop.type)) {
|
1220
1225
|
if (absent && !hasOwn(prop, 'default')) {
|
1221
1226
|
value = false;
|
1222
|
-
} else if (value === '' || value === hyphenate(key)) {
|
1227
|
+
} else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
|
1223
1228
|
value = true;
|
1224
1229
|
}
|
1225
1230
|
}
|
@@ -1360,12 +1365,12 @@ function getType (fn) {
|
|
1360
1365
|
return match && match[1]
|
1361
1366
|
}
|
1362
1367
|
|
1363
|
-
function
|
1368
|
+
function isType (type, fn) {
|
1364
1369
|
if (!Array.isArray(fn)) {
|
1365
|
-
return getType(fn) ===
|
1370
|
+
return getType(fn) === getType(type)
|
1366
1371
|
}
|
1367
1372
|
for (var i = 0, len = fn.length; i < len; i++) {
|
1368
|
-
if (getType(fn[i]) ===
|
1373
|
+
if (getType(fn[i]) === getType(type)) {
|
1369
1374
|
return true
|
1370
1375
|
}
|
1371
1376
|
}
|
@@ -1610,16 +1615,17 @@ var Watcher = function Watcher (
|
|
1610
1615
|
cb,
|
1611
1616
|
options
|
1612
1617
|
) {
|
1613
|
-
if ( options === void 0 ) options = {};
|
1614
|
-
|
1615
1618
|
this.vm = vm;
|
1616
1619
|
vm._watchers.push(this);
|
1617
1620
|
// options
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1621
|
+
if (options) {
|
1622
|
+
this.deep = !!options.deep;
|
1623
|
+
this.user = !!options.user;
|
1624
|
+
this.lazy = !!options.lazy;
|
1625
|
+
this.sync = !!options.sync;
|
1626
|
+
} else {
|
1627
|
+
this.deep = this.user = this.lazy = this.sync = false;
|
1628
|
+
}
|
1623
1629
|
this.cb = cb;
|
1624
1630
|
this.id = ++uid$2; // uid for batching
|
1625
1631
|
this.active = true;
|
@@ -1628,6 +1634,7 @@ var Watcher = function Watcher (
|
|
1628
1634
|
this.newDeps = [];
|
1629
1635
|
this.depIds = new _Set();
|
1630
1636
|
this.newDepIds = new _Set();
|
1637
|
+
this.expression = expOrFn.toString();
|
1631
1638
|
// parse expression for getter
|
1632
1639
|
if (typeof expOrFn === 'function') {
|
1633
1640
|
this.getter = expOrFn;
|
@@ -1723,8 +1730,8 @@ Watcher.prototype.update = function update () {
|
|
1723
1730
|
Watcher.prototype.run = function run () {
|
1724
1731
|
if (this.active) {
|
1725
1732
|
var value = this.get();
|
1726
|
-
|
1727
|
-
|
1733
|
+
if (
|
1734
|
+
value !== this.value ||
|
1728
1735
|
// Deep watchers and watchers on Object/Arrays should fire even
|
1729
1736
|
// when the value is the same, because the value may
|
1730
1737
|
// have mutated.
|
@@ -1837,50 +1844,52 @@ function _traverse (val, seen) {
|
|
1837
1844
|
|
1838
1845
|
function initState (vm) {
|
1839
1846
|
vm._watchers = [];
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1847
|
+
var opts = vm.$options;
|
1848
|
+
if (opts.props) { initProps(vm, opts.props); }
|
1849
|
+
if (opts.methods) { initMethods(vm, opts.methods); }
|
1850
|
+
if (opts.data) {
|
1851
|
+
initData(vm);
|
1852
|
+
} else {
|
1853
|
+
observe(vm._data = {}, true /* asRootData */);
|
1854
|
+
}
|
1855
|
+
if (opts.computed) { initComputed(vm, opts.computed); }
|
1856
|
+
if (opts.watch) { initWatch(vm, opts.watch); }
|
1845
1857
|
}
|
1846
1858
|
|
1847
1859
|
var isReservedProp = { key: 1, ref: 1, slot: 1 };
|
1848
1860
|
|
1849
|
-
function initProps (vm) {
|
1850
|
-
var
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1861
|
+
function initProps (vm, props) {
|
1862
|
+
var propsData = vm.$options.propsData || {};
|
1863
|
+
var keys = vm.$options._propKeys = Object.keys(props);
|
1864
|
+
var isRoot = !vm.$parent;
|
1865
|
+
// root instance props should be converted
|
1866
|
+
observerState.shouldConvert = isRoot;
|
1867
|
+
var loop = function ( i ) {
|
1868
|
+
var key = keys[i];
|
1869
|
+
/* istanbul ignore else */
|
1870
|
+
{
|
1871
|
+
if (isReservedProp[key]) {
|
1872
|
+
warn(
|
1873
|
+
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
|
1874
|
+
vm
|
1875
|
+
);
|
1876
|
+
}
|
1877
|
+
defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
|
1878
|
+
if (vm.$parent && !observerState.isSettingProps) {
|
1862
1879
|
warn(
|
1863
|
-
|
1880
|
+
"Avoid mutating a prop directly since the value will be " +
|
1881
|
+
"overwritten whenever the parent component re-renders. " +
|
1882
|
+
"Instead, use a data or computed property based on the prop's " +
|
1883
|
+
"value. Prop being mutated: \"" + key + "\"",
|
1864
1884
|
vm
|
1865
1885
|
);
|
1866
1886
|
}
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
"Avoid mutating a prop directly since the value will be " +
|
1871
|
-
"overwritten whenever the parent component re-renders. " +
|
1872
|
-
"Instead, use a data or computed property based on the prop's " +
|
1873
|
-
"value. Prop being mutated: \"" + key + "\"",
|
1874
|
-
vm
|
1875
|
-
);
|
1876
|
-
}
|
1877
|
-
});
|
1878
|
-
}
|
1879
|
-
};
|
1887
|
+
});
|
1888
|
+
}
|
1889
|
+
};
|
1880
1890
|
|
1881
|
-
|
1882
|
-
|
1883
|
-
}
|
1891
|
+
for (var i = 0; i < keys.length; i++) loop( i );
|
1892
|
+
observerState.shouldConvert = true;
|
1884
1893
|
}
|
1885
1894
|
|
1886
1895
|
function initData (vm) {
|
@@ -1912,8 +1921,7 @@ function initData (vm) {
|
|
1912
1921
|
}
|
1913
1922
|
}
|
1914
1923
|
// observe data
|
1915
|
-
observe(data);
|
1916
|
-
data.__ob__ && data.__ob__.vmCount++;
|
1924
|
+
observe(data, true /* asRootData */);
|
1917
1925
|
}
|
1918
1926
|
|
1919
1927
|
var computedSharedDefinition = {
|
@@ -1923,26 +1931,23 @@ var computedSharedDefinition = {
|
|
1923
1931
|
set: noop
|
1924
1932
|
};
|
1925
1933
|
|
1926
|
-
function initComputed (vm) {
|
1927
|
-
var
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
? bind$1(userDef.set, vm)
|
1942
|
-
: noop;
|
1943
|
-
}
|
1944
|
-
Object.defineProperty(vm, key, computedSharedDefinition);
|
1934
|
+
function initComputed (vm, computed) {
|
1935
|
+
for (var key in computed) {
|
1936
|
+
var userDef = computed[key];
|
1937
|
+
if (typeof userDef === 'function') {
|
1938
|
+
computedSharedDefinition.get = makeComputedGetter(userDef, vm);
|
1939
|
+
computedSharedDefinition.set = noop;
|
1940
|
+
} else {
|
1941
|
+
computedSharedDefinition.get = userDef.get
|
1942
|
+
? userDef.cache !== false
|
1943
|
+
? makeComputedGetter(userDef.get, vm)
|
1944
|
+
: bind$1(userDef.get, vm)
|
1945
|
+
: noop;
|
1946
|
+
computedSharedDefinition.set = userDef.set
|
1947
|
+
? bind$1(userDef.set, vm)
|
1948
|
+
: noop;
|
1945
1949
|
}
|
1950
|
+
Object.defineProperty(vm, key, computedSharedDefinition);
|
1946
1951
|
}
|
1947
1952
|
}
|
1948
1953
|
|
@@ -1961,34 +1966,28 @@ function makeComputedGetter (getter, owner) {
|
|
1961
1966
|
}
|
1962
1967
|
}
|
1963
1968
|
|
1964
|
-
function initMethods (vm) {
|
1965
|
-
var
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
vm
|
1974
|
-
);
|
1975
|
-
}
|
1969
|
+
function initMethods (vm, methods) {
|
1970
|
+
for (var key in methods) {
|
1971
|
+
vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
|
1972
|
+
if ("development" !== 'production' && methods[key] == null) {
|
1973
|
+
warn(
|
1974
|
+
"method \"" + key + "\" has an undefined value in the component definition. " +
|
1975
|
+
"Did you reference the function correctly?",
|
1976
|
+
vm
|
1977
|
+
);
|
1976
1978
|
}
|
1977
1979
|
}
|
1978
1980
|
}
|
1979
1981
|
|
1980
|
-
function initWatch (vm) {
|
1981
|
-
var
|
1982
|
-
|
1983
|
-
|
1984
|
-
var
|
1985
|
-
|
1986
|
-
for (var i = 0; i < handler.length; i++) {
|
1987
|
-
createWatcher(vm, key, handler[i]);
|
1988
|
-
}
|
1989
|
-
} else {
|
1990
|
-
createWatcher(vm, key, handler);
|
1982
|
+
function initWatch (vm, watch) {
|
1983
|
+
for (var key in watch) {
|
1984
|
+
var handler = watch[key];
|
1985
|
+
if (Array.isArray(handler)) {
|
1986
|
+
for (var i = 0; i < handler.length; i++) {
|
1987
|
+
createWatcher(vm, key, handler[i]);
|
1991
1988
|
}
|
1989
|
+
} else {
|
1990
|
+
createWatcher(vm, key, handler);
|
1992
1991
|
}
|
1993
1992
|
}
|
1994
1993
|
}
|
@@ -2133,6 +2132,273 @@ function cloneVNodes (vnodes) {
|
|
2133
2132
|
|
2134
2133
|
/* */
|
2135
2134
|
|
2135
|
+
function mergeVNodeHook (def, hookKey, hook, key) {
|
2136
|
+
key = key + hookKey;
|
2137
|
+
var injectedHash = def.__injected || (def.__injected = {});
|
2138
|
+
if (!injectedHash[key]) {
|
2139
|
+
injectedHash[key] = true;
|
2140
|
+
var oldHook = def[hookKey];
|
2141
|
+
if (oldHook) {
|
2142
|
+
def[hookKey] = function () {
|
2143
|
+
oldHook.apply(this, arguments);
|
2144
|
+
hook.apply(this, arguments);
|
2145
|
+
};
|
2146
|
+
} else {
|
2147
|
+
def[hookKey] = hook;
|
2148
|
+
}
|
2149
|
+
}
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
/* */
|
2153
|
+
|
2154
|
+
function updateListeners (
|
2155
|
+
on,
|
2156
|
+
oldOn,
|
2157
|
+
add,
|
2158
|
+
remove$$1,
|
2159
|
+
vm
|
2160
|
+
) {
|
2161
|
+
var name, cur, old, fn, event, capture, once;
|
2162
|
+
for (name in on) {
|
2163
|
+
cur = on[name];
|
2164
|
+
old = oldOn[name];
|
2165
|
+
if (!cur) {
|
2166
|
+
"development" !== 'production' && warn(
|
2167
|
+
"Invalid handler for event \"" + name + "\": got " + String(cur),
|
2168
|
+
vm
|
2169
|
+
);
|
2170
|
+
} else if (!old) {
|
2171
|
+
once = name.charAt(0) === '~'; // Prefixed last, checked first
|
2172
|
+
event = once ? name.slice(1) : name;
|
2173
|
+
capture = event.charAt(0) === '!';
|
2174
|
+
event = capture ? event.slice(1) : event;
|
2175
|
+
if (Array.isArray(cur)) {
|
2176
|
+
add(event, (cur.invoker = arrInvoker(cur)), once, capture);
|
2177
|
+
} else {
|
2178
|
+
if (!cur.invoker) {
|
2179
|
+
fn = cur;
|
2180
|
+
cur = on[name] = {};
|
2181
|
+
cur.fn = fn;
|
2182
|
+
cur.invoker = fnInvoker(cur);
|
2183
|
+
}
|
2184
|
+
add(event, cur.invoker, once, capture);
|
2185
|
+
}
|
2186
|
+
} else if (cur !== old) {
|
2187
|
+
if (Array.isArray(old)) {
|
2188
|
+
old.length = cur.length;
|
2189
|
+
for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
|
2190
|
+
on[name] = old;
|
2191
|
+
} else {
|
2192
|
+
old.fn = cur;
|
2193
|
+
on[name] = old;
|
2194
|
+
}
|
2195
|
+
}
|
2196
|
+
}
|
2197
|
+
for (name in oldOn) {
|
2198
|
+
if (!on[name]) {
|
2199
|
+
once = name.charAt(0) === '~'; // Prefixed last, checked first
|
2200
|
+
event = once ? name.slice(1) : name;
|
2201
|
+
capture = event.charAt(0) === '!';
|
2202
|
+
event = capture ? event.slice(1) : event;
|
2203
|
+
remove$$1(event, oldOn[name].invoker, capture);
|
2204
|
+
}
|
2205
|
+
}
|
2206
|
+
}
|
2207
|
+
|
2208
|
+
function arrInvoker (arr) {
|
2209
|
+
return function (ev) {
|
2210
|
+
var arguments$1 = arguments;
|
2211
|
+
|
2212
|
+
var single = arguments.length === 1;
|
2213
|
+
for (var i = 0; i < arr.length; i++) {
|
2214
|
+
single ? arr[i](ev) : arr[i].apply(null, arguments$1);
|
2215
|
+
}
|
2216
|
+
}
|
2217
|
+
}
|
2218
|
+
|
2219
|
+
function fnInvoker (o) {
|
2220
|
+
return function (ev) {
|
2221
|
+
var single = arguments.length === 1;
|
2222
|
+
single ? o.fn(ev) : o.fn.apply(null, arguments);
|
2223
|
+
}
|
2224
|
+
}
|
2225
|
+
|
2226
|
+
/* */
|
2227
|
+
|
2228
|
+
// The template compiler attempts to minimize the need for normalization by
|
2229
|
+
// statically analyzing the template at compile time.
|
2230
|
+
//
|
2231
|
+
// For plain HTML markup, normalization can be completely skipped because the
|
2232
|
+
// generated render function is guaranteed to return Array<VNode>. There are
|
2233
|
+
// two cases where extra normalization is needed:
|
2234
|
+
|
2235
|
+
// 1. When the children contains components - because a functional component
|
2236
|
+
// may return an Array instead of a single root. In this case, just a simple
|
2237
|
+
// nomralization is needed - if any child is an Array, we flatten the whole
|
2238
|
+
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
|
2239
|
+
// because functional components already normalize their own children.
|
2240
|
+
function simpleNormalizeChildren (children) {
|
2241
|
+
for (var i = 0; i < children.length; i++) {
|
2242
|
+
if (Array.isArray(children[i])) {
|
2243
|
+
return Array.prototype.concat.apply([], children)
|
2244
|
+
}
|
2245
|
+
}
|
2246
|
+
return children
|
2247
|
+
}
|
2248
|
+
|
2249
|
+
// 2. When the children contains constrcuts that always generated nested Arrays,
|
2250
|
+
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
2251
|
+
// with hand-written render functions / JSX. In such cases a full normalization
|
2252
|
+
// is needed to cater to all possible types of children values.
|
2253
|
+
function normalizeChildren (children) {
|
2254
|
+
return isPrimitive(children)
|
2255
|
+
? [createTextVNode(children)]
|
2256
|
+
: Array.isArray(children)
|
2257
|
+
? normalizeArrayChildren(children)
|
2258
|
+
: undefined
|
2259
|
+
}
|
2260
|
+
|
2261
|
+
function normalizeArrayChildren (children, nestedIndex) {
|
2262
|
+
var res = [];
|
2263
|
+
var i, c, last;
|
2264
|
+
for (i = 0; i < children.length; i++) {
|
2265
|
+
c = children[i];
|
2266
|
+
if (c == null || typeof c === 'boolean') { continue }
|
2267
|
+
last = res[res.length - 1];
|
2268
|
+
// nested
|
2269
|
+
if (Array.isArray(c)) {
|
2270
|
+
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
|
2271
|
+
} else if (isPrimitive(c)) {
|
2272
|
+
if (last && last.text) {
|
2273
|
+
last.text += String(c);
|
2274
|
+
} else if (c !== '') {
|
2275
|
+
// convert primitive to vnode
|
2276
|
+
res.push(createTextVNode(c));
|
2277
|
+
}
|
2278
|
+
} else {
|
2279
|
+
if (c.text && last && last.text) {
|
2280
|
+
res[res.length - 1] = createTextVNode(last.text + c.text);
|
2281
|
+
} else {
|
2282
|
+
// default key for nested array children (likely generated by v-for)
|
2283
|
+
if (c.tag && c.key == null && nestedIndex != null) {
|
2284
|
+
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2285
|
+
}
|
2286
|
+
res.push(c);
|
2287
|
+
}
|
2288
|
+
}
|
2289
|
+
}
|
2290
|
+
return res
|
2291
|
+
}
|
2292
|
+
|
2293
|
+
/* */
|
2294
|
+
|
2295
|
+
function getFirstComponentChild (children) {
|
2296
|
+
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
|
2297
|
+
}
|
2298
|
+
|
2299
|
+
/* */
|
2300
|
+
|
2301
|
+
function initEvents (vm) {
|
2302
|
+
vm._events = Object.create(null);
|
2303
|
+
vm._hasHookEvent = false;
|
2304
|
+
// init parent attached events
|
2305
|
+
var listeners = vm.$options._parentListeners;
|
2306
|
+
if (listeners) {
|
2307
|
+
updateComponentListeners(vm, listeners);
|
2308
|
+
}
|
2309
|
+
}
|
2310
|
+
|
2311
|
+
var target;
|
2312
|
+
|
2313
|
+
function add$1 (event, fn, once) {
|
2314
|
+
if (once) {
|
2315
|
+
target.$once(event, fn);
|
2316
|
+
} else {
|
2317
|
+
target.$on(event, fn);
|
2318
|
+
}
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
function remove$2 (event, fn) {
|
2322
|
+
target.$off(event, fn);
|
2323
|
+
}
|
2324
|
+
|
2325
|
+
function updateComponentListeners (
|
2326
|
+
vm,
|
2327
|
+
listeners,
|
2328
|
+
oldListeners
|
2329
|
+
) {
|
2330
|
+
target = vm;
|
2331
|
+
updateListeners(listeners, oldListeners || {}, add$1, remove$2, vm);
|
2332
|
+
}
|
2333
|
+
|
2334
|
+
function eventsMixin (Vue) {
|
2335
|
+
var hookRE = /^hook:/;
|
2336
|
+
Vue.prototype.$on = function (event, fn) {
|
2337
|
+
var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
|
2338
|
+
// optimize hook:event cost by using a boolean flag marked at registration
|
2339
|
+
// instead of a hash lookup
|
2340
|
+
if (hookRE.test(event)) {
|
2341
|
+
vm._hasHookEvent = true;
|
2342
|
+
}
|
2343
|
+
return vm
|
2344
|
+
};
|
2345
|
+
|
2346
|
+
Vue.prototype.$once = function (event, fn) {
|
2347
|
+
var vm = this;
|
2348
|
+
function on () {
|
2349
|
+
vm.$off(event, on);
|
2350
|
+
fn.apply(vm, arguments);
|
2351
|
+
}
|
2352
|
+
on.fn = fn;
|
2353
|
+
vm.$on(event, on);
|
2354
|
+
return vm
|
2355
|
+
};
|
2356
|
+
|
2357
|
+
Vue.prototype.$off = function (event, fn) {
|
2358
|
+
var vm = this;
|
2359
|
+
// all
|
2360
|
+
if (!arguments.length) {
|
2361
|
+
vm._events = Object.create(null);
|
2362
|
+
return vm
|
2363
|
+
}
|
2364
|
+
// specific event
|
2365
|
+
var cbs = vm._events[event];
|
2366
|
+
if (!cbs) {
|
2367
|
+
return vm
|
2368
|
+
}
|
2369
|
+
if (arguments.length === 1) {
|
2370
|
+
vm._events[event] = null;
|
2371
|
+
return vm
|
2372
|
+
}
|
2373
|
+
// specific handler
|
2374
|
+
var cb;
|
2375
|
+
var i = cbs.length;
|
2376
|
+
while (i--) {
|
2377
|
+
cb = cbs[i];
|
2378
|
+
if (cb === fn || cb.fn === fn) {
|
2379
|
+
cbs.splice(i, 1);
|
2380
|
+
break
|
2381
|
+
}
|
2382
|
+
}
|
2383
|
+
return vm
|
2384
|
+
};
|
2385
|
+
|
2386
|
+
Vue.prototype.$emit = function (event) {
|
2387
|
+
var vm = this;
|
2388
|
+
var cbs = vm._events[event];
|
2389
|
+
if (cbs) {
|
2390
|
+
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
2391
|
+
var args = toArray(arguments, 1);
|
2392
|
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
2393
|
+
cbs[i].apply(vm, args);
|
2394
|
+
}
|
2395
|
+
}
|
2396
|
+
return vm
|
2397
|
+
};
|
2398
|
+
}
|
2399
|
+
|
2400
|
+
/* */
|
2401
|
+
|
2136
2402
|
var activeInstance = null;
|
2137
2403
|
|
2138
2404
|
function initLifecycle (vm) {
|
@@ -2275,7 +2541,7 @@ function lifecycleMixin (Vue) {
|
|
2275
2541
|
if (listeners) {
|
2276
2542
|
var oldListeners = vm.$options._parentListeners;
|
2277
2543
|
vm.$options._parentListeners = listeners;
|
2278
|
-
vm
|
2544
|
+
updateComponentListeners(vm, listeners, oldListeners);
|
2279
2545
|
}
|
2280
2546
|
// resolve slots + force update if has children
|
2281
2547
|
if (hasChildren) {
|
@@ -2337,7 +2603,9 @@ function callHook (vm, hook) {
|
|
2337
2603
|
handlers[i].call(vm);
|
2338
2604
|
}
|
2339
2605
|
}
|
2340
|
-
vm
|
2606
|
+
if (vm._hasHookEvent) {
|
2607
|
+
vm.$emit('hook:' + hook);
|
2608
|
+
}
|
2341
2609
|
}
|
2342
2610
|
|
2343
2611
|
/* */
|
@@ -2563,244 +2831,106 @@ function resolveAsyncComponent (
|
|
2563
2831
|
// cache resolved
|
2564
2832
|
factory.resolved = res;
|
2565
2833
|
// invoke callbacks only if this is not a synchronous resolve
|
2566
|
-
// (async resolves are shimmed as synchronous during SSR)
|
2567
|
-
if (!sync) {
|
2568
|
-
for (var i = 0, l = cbs.length; i < l; i++) {
|
2569
|
-
cbs[i](res);
|
2570
|
-
}
|
2571
|
-
}
|
2572
|
-
};
|
2573
|
-
|
2574
|
-
var reject = function (reason) {
|
2575
|
-
"development" !== 'production' && warn(
|
2576
|
-
"Failed to resolve async component: " + (String(factory)) +
|
2577
|
-
(reason ? ("\nReason: " + reason) : '')
|
2578
|
-
);
|
2579
|
-
};
|
2580
|
-
|
2581
|
-
var res = factory(resolve, reject);
|
2582
|
-
|
2583
|
-
// handle promise
|
2584
|
-
if (res && typeof res.then === 'function' && !factory.resolved) {
|
2585
|
-
res.then(resolve, reject);
|
2586
|
-
}
|
2587
|
-
|
2588
|
-
sync = false;
|
2589
|
-
// return in case resolved synchronously
|
2590
|
-
return factory.resolved
|
2591
|
-
}
|
2592
|
-
}
|
2593
|
-
|
2594
|
-
function extractProps (data, Ctor) {
|
2595
|
-
// we are only extracting raw values here.
|
2596
|
-
// validation and default values are handled in the child
|
2597
|
-
// component itself.
|
2598
|
-
var propOptions = Ctor.options.props;
|
2599
|
-
if (!propOptions) {
|
2600
|
-
return
|
2601
|
-
}
|
2602
|
-
var res = {};
|
2603
|
-
var attrs = data.attrs;
|
2604
|
-
var props = data.props;
|
2605
|
-
var domProps = data.domProps;
|
2606
|
-
if (attrs || props || domProps) {
|
2607
|
-
for (var key in propOptions) {
|
2608
|
-
var altKey = hyphenate(key);
|
2609
|
-
checkProp(res, props, key, altKey, true) ||
|
2610
|
-
checkProp(res, attrs, key, altKey) ||
|
2611
|
-
checkProp(res, domProps, key, altKey);
|
2612
|
-
}
|
2613
|
-
}
|
2614
|
-
return res
|
2615
|
-
}
|
2616
|
-
|
2617
|
-
function checkProp (
|
2618
|
-
res,
|
2619
|
-
hash,
|
2620
|
-
key,
|
2621
|
-
altKey,
|
2622
|
-
preserve
|
2623
|
-
) {
|
2624
|
-
if (hash) {
|
2625
|
-
if (hasOwn(hash, key)) {
|
2626
|
-
res[key] = hash[key];
|
2627
|
-
if (!preserve) {
|
2628
|
-
delete hash[key];
|
2629
|
-
}
|
2630
|
-
return true
|
2631
|
-
} else if (hasOwn(hash, altKey)) {
|
2632
|
-
res[key] = hash[altKey];
|
2633
|
-
if (!preserve) {
|
2634
|
-
delete hash[altKey];
|
2635
|
-
}
|
2636
|
-
return true
|
2637
|
-
}
|
2638
|
-
}
|
2639
|
-
return false
|
2640
|
-
}
|
2641
|
-
|
2642
|
-
function mergeHooks (data) {
|
2643
|
-
if (!data.hook) {
|
2644
|
-
data.hook = {};
|
2645
|
-
}
|
2646
|
-
for (var i = 0; i < hooksToMerge.length; i++) {
|
2647
|
-
var key = hooksToMerge[i];
|
2648
|
-
var fromParent = data.hook[key];
|
2649
|
-
var ours = hooks[key];
|
2650
|
-
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
2651
|
-
}
|
2652
|
-
}
|
2653
|
-
|
2654
|
-
function mergeHook$1 (one, two) {
|
2655
|
-
return function (a, b, c, d) {
|
2656
|
-
one(a, b, c, d);
|
2657
|
-
two(a, b, c, d);
|
2658
|
-
}
|
2659
|
-
}
|
2660
|
-
|
2661
|
-
/* */
|
2662
|
-
|
2663
|
-
function mergeVNodeHook (def, hookKey, hook, key) {
|
2664
|
-
key = key + hookKey;
|
2665
|
-
var injectedHash = def.__injected || (def.__injected = {});
|
2666
|
-
if (!injectedHash[key]) {
|
2667
|
-
injectedHash[key] = true;
|
2668
|
-
var oldHook = def[hookKey];
|
2669
|
-
if (oldHook) {
|
2670
|
-
def[hookKey] = function () {
|
2671
|
-
oldHook.apply(this, arguments);
|
2672
|
-
hook.apply(this, arguments);
|
2673
|
-
};
|
2674
|
-
} else {
|
2675
|
-
def[hookKey] = hook;
|
2676
|
-
}
|
2677
|
-
}
|
2678
|
-
}
|
2679
|
-
|
2680
|
-
/* */
|
2681
|
-
|
2682
|
-
function updateListeners (
|
2683
|
-
on,
|
2684
|
-
oldOn,
|
2685
|
-
add,
|
2686
|
-
remove$$1,
|
2687
|
-
vm
|
2688
|
-
) {
|
2689
|
-
var name, cur, old, fn, event, capture, once;
|
2690
|
-
for (name in on) {
|
2691
|
-
cur = on[name];
|
2692
|
-
old = oldOn[name];
|
2693
|
-
if (!cur) {
|
2694
|
-
"development" !== 'production' && warn(
|
2695
|
-
"Invalid handler for event \"" + name + "\": got " + String(cur),
|
2696
|
-
vm
|
2697
|
-
);
|
2698
|
-
} else if (!old) {
|
2699
|
-
once = name.charAt(0) === '~'; // Prefixed last, checked first
|
2700
|
-
event = once ? name.slice(1) : name;
|
2701
|
-
capture = event.charAt(0) === '!';
|
2702
|
-
event = capture ? event.slice(1) : event;
|
2703
|
-
if (Array.isArray(cur)) {
|
2704
|
-
add(event, (cur.invoker = arrInvoker(cur)), once, capture);
|
2705
|
-
} else {
|
2706
|
-
if (!cur.invoker) {
|
2707
|
-
fn = cur;
|
2708
|
-
cur = on[name] = {};
|
2709
|
-
cur.fn = fn;
|
2710
|
-
cur.invoker = fnInvoker(cur);
|
2711
|
-
}
|
2712
|
-
add(event, cur.invoker, once, capture);
|
2713
|
-
}
|
2714
|
-
} else if (cur !== old) {
|
2715
|
-
if (Array.isArray(old)) {
|
2716
|
-
old.length = cur.length;
|
2717
|
-
for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
|
2718
|
-
on[name] = old;
|
2719
|
-
} else {
|
2720
|
-
old.fn = cur;
|
2721
|
-
on[name] = old;
|
2722
|
-
}
|
2723
|
-
}
|
2724
|
-
}
|
2725
|
-
for (name in oldOn) {
|
2726
|
-
if (!on[name]) {
|
2727
|
-
once = name.charAt(0) === '~'; // Prefixed last, checked first
|
2728
|
-
event = once ? name.slice(1) : name;
|
2729
|
-
capture = event.charAt(0) === '!';
|
2730
|
-
event = capture ? event.slice(1) : event;
|
2731
|
-
remove$$1(event, oldOn[name].invoker, capture);
|
2732
|
-
}
|
2733
|
-
}
|
2734
|
-
}
|
2834
|
+
// (async resolves are shimmed as synchronous during SSR)
|
2835
|
+
if (!sync) {
|
2836
|
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
2837
|
+
cbs[i](res);
|
2838
|
+
}
|
2839
|
+
}
|
2840
|
+
};
|
2735
2841
|
|
2736
|
-
function
|
2737
|
-
|
2738
|
-
|
2842
|
+
var reject = function (reason) {
|
2843
|
+
"development" !== 'production' && warn(
|
2844
|
+
"Failed to resolve async component: " + (String(factory)) +
|
2845
|
+
(reason ? ("\nReason: " + reason) : '')
|
2846
|
+
);
|
2847
|
+
};
|
2739
2848
|
|
2740
|
-
var
|
2741
|
-
|
2742
|
-
|
2849
|
+
var res = factory(resolve, reject);
|
2850
|
+
|
2851
|
+
// handle promise
|
2852
|
+
if (res && typeof res.then === 'function' && !factory.resolved) {
|
2853
|
+
res.then(resolve, reject);
|
2743
2854
|
}
|
2744
|
-
}
|
2745
|
-
}
|
2746
2855
|
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
single ? o.fn(ev) : o.fn.apply(null, arguments);
|
2856
|
+
sync = false;
|
2857
|
+
// return in case resolved synchronously
|
2858
|
+
return factory.resolved
|
2751
2859
|
}
|
2752
2860
|
}
|
2753
2861
|
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2862
|
+
function extractProps (data, Ctor) {
|
2863
|
+
// we are only extracting raw values here.
|
2864
|
+
// validation and default values are handled in the child
|
2865
|
+
// component itself.
|
2866
|
+
var propOptions = Ctor.options.props;
|
2867
|
+
if (!propOptions) {
|
2868
|
+
return
|
2869
|
+
}
|
2870
|
+
var res = {};
|
2871
|
+
var attrs = data.attrs;
|
2872
|
+
var props = data.props;
|
2873
|
+
var domProps = data.domProps;
|
2874
|
+
if (attrs || props || domProps) {
|
2875
|
+
for (var key in propOptions) {
|
2876
|
+
var altKey = hyphenate(key);
|
2877
|
+
checkProp(res, props, key, altKey, true) ||
|
2878
|
+
checkProp(res, attrs, key, altKey) ||
|
2879
|
+
checkProp(res, domProps, key, altKey);
|
2880
|
+
}
|
2881
|
+
}
|
2882
|
+
return res
|
2762
2883
|
}
|
2763
2884
|
|
2764
|
-
function
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
if (
|
2773
|
-
res
|
2774
|
-
|
2775
|
-
|
2776
|
-
last.text += String(c);
|
2777
|
-
} else if (c !== '') {
|
2778
|
-
// convert primitive to vnode
|
2779
|
-
res.push(createTextVNode(c));
|
2885
|
+
function checkProp (
|
2886
|
+
res,
|
2887
|
+
hash,
|
2888
|
+
key,
|
2889
|
+
altKey,
|
2890
|
+
preserve
|
2891
|
+
) {
|
2892
|
+
if (hash) {
|
2893
|
+
if (hasOwn(hash, key)) {
|
2894
|
+
res[key] = hash[key];
|
2895
|
+
if (!preserve) {
|
2896
|
+
delete hash[key];
|
2780
2897
|
}
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
if (c.tag && c.key == null && nestedIndex != null) {
|
2787
|
-
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2788
|
-
}
|
2789
|
-
res.push(c);
|
2898
|
+
return true
|
2899
|
+
} else if (hasOwn(hash, altKey)) {
|
2900
|
+
res[key] = hash[altKey];
|
2901
|
+
if (!preserve) {
|
2902
|
+
delete hash[altKey];
|
2790
2903
|
}
|
2904
|
+
return true
|
2791
2905
|
}
|
2792
2906
|
}
|
2793
|
-
return
|
2907
|
+
return false
|
2794
2908
|
}
|
2795
2909
|
|
2796
|
-
|
2910
|
+
function mergeHooks (data) {
|
2911
|
+
if (!data.hook) {
|
2912
|
+
data.hook = {};
|
2913
|
+
}
|
2914
|
+
for (var i = 0; i < hooksToMerge.length; i++) {
|
2915
|
+
var key = hooksToMerge[i];
|
2916
|
+
var fromParent = data.hook[key];
|
2917
|
+
var ours = hooks[key];
|
2918
|
+
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
2919
|
+
}
|
2920
|
+
}
|
2797
2921
|
|
2798
|
-
function
|
2799
|
-
return
|
2922
|
+
function mergeHook$1 (one, two) {
|
2923
|
+
return function (a, b, c, d) {
|
2924
|
+
one(a, b, c, d);
|
2925
|
+
two(a, b, c, d);
|
2926
|
+
}
|
2800
2927
|
}
|
2801
2928
|
|
2802
2929
|
/* */
|
2803
2930
|
|
2931
|
+
var SIMPLE_NORMALIZE = 1;
|
2932
|
+
var ALWAYS_NORMALIZE = 2;
|
2933
|
+
|
2804
2934
|
// wrapper function for providing a more flexible interface
|
2805
2935
|
// without getting yelled at by flow
|
2806
2936
|
function createElement (
|
@@ -2808,16 +2938,16 @@ function createElement (
|
|
2808
2938
|
tag,
|
2809
2939
|
data,
|
2810
2940
|
children,
|
2811
|
-
|
2941
|
+
normalizationType,
|
2812
2942
|
alwaysNormalize
|
2813
2943
|
) {
|
2814
2944
|
if (Array.isArray(data) || isPrimitive(data)) {
|
2815
|
-
|
2945
|
+
normalizationType = children;
|
2816
2946
|
children = data;
|
2817
2947
|
data = undefined;
|
2818
2948
|
}
|
2819
|
-
if (alwaysNormalize) {
|
2820
|
-
return _createElement(context, tag, data, children,
|
2949
|
+
if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
|
2950
|
+
return _createElement(context, tag, data, children, normalizationType)
|
2821
2951
|
}
|
2822
2952
|
|
2823
2953
|
function _createElement (
|
@@ -2825,7 +2955,7 @@ function _createElement (
|
|
2825
2955
|
tag,
|
2826
2956
|
data,
|
2827
2957
|
children,
|
2828
|
-
|
2958
|
+
normalizationType
|
2829
2959
|
) {
|
2830
2960
|
if (data && data.__ob__) {
|
2831
2961
|
"development" !== 'production' && warn(
|
@@ -2846,8 +2976,10 @@ function _createElement (
|
|
2846
2976
|
data.scopedSlots = { default: children[0] };
|
2847
2977
|
children.length = 0;
|
2848
2978
|
}
|
2849
|
-
if (
|
2979
|
+
if (normalizationType === ALWAYS_NORMALIZE) {
|
2850
2980
|
children = normalizeChildren(children);
|
2981
|
+
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
2982
|
+
children = simpleNormalizeChildren(children);
|
2851
2983
|
}
|
2852
2984
|
var vnode, ns;
|
2853
2985
|
if (typeof tag === 'string') {
|
@@ -2866,7 +2998,6 @@ function _createElement (
|
|
2866
2998
|
// unknown or unlisted namespaced elements
|
2867
2999
|
// check at runtime because it may get assigned a namespace when its
|
2868
3000
|
// parent normalizes children
|
2869
|
-
ns = tag === 'foreignObject' ? 'xhtml' : ns;
|
2870
3001
|
vnode = new VNode(
|
2871
3002
|
tag, data, children,
|
2872
3003
|
undefined, undefined, context
|
@@ -2886,6 +3017,10 @@ function _createElement (
|
|
2886
3017
|
|
2887
3018
|
function applyNS (vnode, ns) {
|
2888
3019
|
vnode.ns = ns;
|
3020
|
+
if (vnode.tag === 'foreignObject') {
|
3021
|
+
// use default namespace inside foreignObject
|
3022
|
+
return
|
3023
|
+
}
|
2889
3024
|
if (vnode.children) {
|
2890
3025
|
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
2891
3026
|
var child = vnode.children[i];
|
@@ -2908,7 +3043,7 @@ function initRender (vm) {
|
|
2908
3043
|
vm.$scopedSlots = {};
|
2909
3044
|
// bind the createElement fn to this instance
|
2910
3045
|
// so that we get proper render context inside it.
|
2911
|
-
// args order: tag, data, children,
|
3046
|
+
// args order: tag, data, children, normalizationType, alwaysNormalize
|
2912
3047
|
// internal version is used by render functions compiled from templates
|
2913
3048
|
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
2914
3049
|
// normalization is always applied for the public version, used in
|
@@ -3052,7 +3187,7 @@ function renderMixin (Vue) {
|
|
3052
3187
|
render
|
3053
3188
|
) {
|
3054
3189
|
var ret, i, l, keys, key;
|
3055
|
-
if (Array.isArray(val)) {
|
3190
|
+
if (Array.isArray(val) || typeof val === 'string') {
|
3056
3191
|
ret = new Array(val.length);
|
3057
3192
|
for (i = 0, l = val.length; i < l; i++) {
|
3058
3193
|
ret[i] = render(val[i], i);
|
@@ -3077,11 +3212,16 @@ function renderMixin (Vue) {
|
|
3077
3212
|
Vue.prototype._t = function (
|
3078
3213
|
name,
|
3079
3214
|
fallback,
|
3080
|
-
props
|
3215
|
+
props,
|
3216
|
+
bindObject
|
3081
3217
|
) {
|
3082
3218
|
var scopedSlotFn = this.$scopedSlots[name];
|
3083
3219
|
if (scopedSlotFn) { // scoped slot
|
3084
|
-
|
3220
|
+
props = props || {};
|
3221
|
+
if (bindObject) {
|
3222
|
+
extend(props, bindObject);
|
3223
|
+
}
|
3224
|
+
return scopedSlotFn(props) || fallback
|
3085
3225
|
} else {
|
3086
3226
|
var slotNodes = this.$slots[name];
|
3087
3227
|
// warn duplicate slot usage
|
@@ -3182,84 +3322,6 @@ function resolveSlots (
|
|
3182
3322
|
|
3183
3323
|
/* */
|
3184
3324
|
|
3185
|
-
function initEvents (vm) {
|
3186
|
-
vm._events = Object.create(null);
|
3187
|
-
// init parent attached events
|
3188
|
-
var listeners = vm.$options._parentListeners;
|
3189
|
-
var add = function (event, fn, once) {
|
3190
|
-
once ? vm.$once(event, fn) : vm.$on(event, fn);
|
3191
|
-
};
|
3192
|
-
var remove$$1 = bind$1(vm.$off, vm);
|
3193
|
-
vm._updateListeners = function (listeners, oldListeners) {
|
3194
|
-
updateListeners(listeners, oldListeners || {}, add, remove$$1, vm);
|
3195
|
-
};
|
3196
|
-
if (listeners) {
|
3197
|
-
vm._updateListeners(listeners);
|
3198
|
-
}
|
3199
|
-
}
|
3200
|
-
|
3201
|
-
function eventsMixin (Vue) {
|
3202
|
-
Vue.prototype.$on = function (event, fn) {
|
3203
|
-
var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
|
3204
|
-
return vm
|
3205
|
-
};
|
3206
|
-
|
3207
|
-
Vue.prototype.$once = function (event, fn) {
|
3208
|
-
var vm = this;
|
3209
|
-
function on () {
|
3210
|
-
vm.$off(event, on);
|
3211
|
-
fn.apply(vm, arguments);
|
3212
|
-
}
|
3213
|
-
on.fn = fn;
|
3214
|
-
vm.$on(event, on);
|
3215
|
-
return vm
|
3216
|
-
};
|
3217
|
-
|
3218
|
-
Vue.prototype.$off = function (event, fn) {
|
3219
|
-
var vm = this;
|
3220
|
-
// all
|
3221
|
-
if (!arguments.length) {
|
3222
|
-
vm._events = Object.create(null);
|
3223
|
-
return vm
|
3224
|
-
}
|
3225
|
-
// specific event
|
3226
|
-
var cbs = vm._events[event];
|
3227
|
-
if (!cbs) {
|
3228
|
-
return vm
|
3229
|
-
}
|
3230
|
-
if (arguments.length === 1) {
|
3231
|
-
vm._events[event] = null;
|
3232
|
-
return vm
|
3233
|
-
}
|
3234
|
-
// specific handler
|
3235
|
-
var cb;
|
3236
|
-
var i = cbs.length;
|
3237
|
-
while (i--) {
|
3238
|
-
cb = cbs[i];
|
3239
|
-
if (cb === fn || cb.fn === fn) {
|
3240
|
-
cbs.splice(i, 1);
|
3241
|
-
break
|
3242
|
-
}
|
3243
|
-
}
|
3244
|
-
return vm
|
3245
|
-
};
|
3246
|
-
|
3247
|
-
Vue.prototype.$emit = function (event) {
|
3248
|
-
var vm = this;
|
3249
|
-
var cbs = vm._events[event];
|
3250
|
-
if (cbs) {
|
3251
|
-
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
3252
|
-
var args = toArray(arguments, 1);
|
3253
|
-
for (var i = 0, l = cbs.length; i < l; i++) {
|
3254
|
-
cbs[i].apply(vm, args);
|
3255
|
-
}
|
3256
|
-
}
|
3257
|
-
return vm
|
3258
|
-
};
|
3259
|
-
}
|
3260
|
-
|
3261
|
-
/* */
|
3262
|
-
|
3263
3325
|
var uid = 0;
|
3264
3326
|
|
3265
3327
|
function initMixin (Vue) {
|
@@ -3587,7 +3649,7 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
|
|
3587
3649
|
get: isServerRendering
|
3588
3650
|
});
|
3589
3651
|
|
3590
|
-
Vue$3.version = '2.1.
|
3652
|
+
Vue$3.version = '2.1.7';
|
3591
3653
|
|
3592
3654
|
/* */
|
3593
3655
|
|
@@ -3703,8 +3765,7 @@ function stringifyClass (value) {
|
|
3703
3765
|
|
3704
3766
|
var namespaceMap = {
|
3705
3767
|
svg: 'http://www.w3.org/2000/svg',
|
3706
|
-
math: 'http://www.w3.org/1998/Math/MathML'
|
3707
|
-
xhtml: 'http://www.w3.org/1999/xhtml'
|
3768
|
+
math: 'http://www.w3.org/1998/Math/MathML'
|
3708
3769
|
};
|
3709
3770
|
|
3710
3771
|
var isHTMLTag = makeMap(
|
@@ -3974,16 +4035,16 @@ function createPatchFunction (backend) {
|
|
3974
4035
|
function createRmCb (childElm, listeners) {
|
3975
4036
|
function remove$$1 () {
|
3976
4037
|
if (--remove$$1.listeners === 0) {
|
3977
|
-
|
4038
|
+
removeNode(childElm);
|
3978
4039
|
}
|
3979
4040
|
}
|
3980
4041
|
remove$$1.listeners = listeners;
|
3981
4042
|
return remove$$1
|
3982
4043
|
}
|
3983
4044
|
|
3984
|
-
function
|
4045
|
+
function removeNode (el) {
|
3985
4046
|
var parent = nodeOps.parentNode(el);
|
3986
|
-
// element may have already been removed due to v-html
|
4047
|
+
// element may have already been removed due to v-html / v-text
|
3987
4048
|
if (parent) {
|
3988
4049
|
nodeOps.removeChild(parent, el);
|
3989
4050
|
}
|
@@ -4007,7 +4068,7 @@ function createPatchFunction (backend) {
|
|
4007
4068
|
if (
|
4008
4069
|
!inPre &&
|
4009
4070
|
!vnode.ns &&
|
4010
|
-
!(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
|
4071
|
+
!(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
|
4011
4072
|
config.isUnknownElement(tag)
|
4012
4073
|
) {
|
4013
4074
|
warn(
|
@@ -4185,7 +4246,7 @@ function createPatchFunction (backend) {
|
|
4185
4246
|
removeAndInvokeRemoveHook(ch);
|
4186
4247
|
invokeDestroyHook(ch);
|
4187
4248
|
} else { // Text node
|
4188
|
-
|
4249
|
+
removeNode(ch.elm);
|
4189
4250
|
}
|
4190
4251
|
}
|
4191
4252
|
}
|
@@ -4215,7 +4276,7 @@ function createPatchFunction (backend) {
|
|
4215
4276
|
rm();
|
4216
4277
|
}
|
4217
4278
|
} else {
|
4218
|
-
|
4279
|
+
removeNode(vnode.elm);
|
4219
4280
|
}
|
4220
4281
|
}
|
4221
4282
|
|
@@ -4476,7 +4537,6 @@ function createPatchFunction (backend) {
|
|
4476
4537
|
// create an empty node and replace it
|
4477
4538
|
oldVnode = emptyNodeAt(oldVnode);
|
4478
4539
|
}
|
4479
|
-
|
4480
4540
|
// replacing existing element
|
4481
4541
|
elm = oldVnode.elm;
|
4482
4542
|
parent = nodeOps.parentNode(elm);
|
@@ -4528,6 +4588,7 @@ function updateDirectives (oldVnode, vnode) {
|
|
4528
4588
|
|
4529
4589
|
function _update (oldVnode, vnode) {
|
4530
4590
|
var isCreate = oldVnode === emptyNode;
|
4591
|
+
var isDestroy = vnode === emptyNode;
|
4531
4592
|
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
4532
4593
|
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
4533
4594
|
|
@@ -4579,7 +4640,7 @@ function _update (oldVnode, vnode) {
|
|
4579
4640
|
for (key in oldDirs) {
|
4580
4641
|
if (!newDirs[key]) {
|
4581
4642
|
// no longer present, unbind
|
4582
|
-
callHook$1(oldDirs[key], 'unbind', oldVnode);
|
4643
|
+
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
4583
4644
|
}
|
4584
4645
|
}
|
4585
4646
|
}
|
@@ -4611,10 +4672,10 @@ function getRawDirName (dir) {
|
|
4611
4672
|
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
4612
4673
|
}
|
4613
4674
|
|
4614
|
-
function callHook$1 (dir, hook, vnode, oldVnode) {
|
4675
|
+
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
4615
4676
|
var fn = dir.def && dir.def[hook];
|
4616
4677
|
if (fn) {
|
4617
|
-
fn(vnode.elm, dir, vnode, oldVnode);
|
4678
|
+
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
4618
4679
|
}
|
4619
4680
|
}
|
4620
4681
|
|
@@ -4725,23 +4786,23 @@ var klass = {
|
|
4725
4786
|
|
4726
4787
|
/* */
|
4727
4788
|
|
4728
|
-
var target;
|
4789
|
+
var target$1;
|
4729
4790
|
|
4730
|
-
function add$
|
4791
|
+
function add$2 (event, handler, once, capture) {
|
4731
4792
|
if (once) {
|
4732
4793
|
var oldHandler = handler;
|
4733
4794
|
handler = function (ev) {
|
4734
|
-
remove$
|
4795
|
+
remove$3(event, handler, capture);
|
4735
4796
|
arguments.length === 1
|
4736
4797
|
? oldHandler(ev)
|
4737
4798
|
: oldHandler.apply(null, arguments);
|
4738
4799
|
};
|
4739
4800
|
}
|
4740
|
-
target.addEventListener(event, handler, capture);
|
4801
|
+
target$1.addEventListener(event, handler, capture);
|
4741
4802
|
}
|
4742
4803
|
|
4743
|
-
function remove$
|
4744
|
-
target.removeEventListener(event, handler, capture);
|
4804
|
+
function remove$3 (event, handler, capture) {
|
4805
|
+
target$1.removeEventListener(event, handler, capture);
|
4745
4806
|
}
|
4746
4807
|
|
4747
4808
|
function updateDOMListeners (oldVnode, vnode) {
|
@@ -4750,8 +4811,8 @@ function updateDOMListeners (oldVnode, vnode) {
|
|
4750
4811
|
}
|
4751
4812
|
var on = vnode.data.on || {};
|
4752
4813
|
var oldOn = oldVnode.data.on || {};
|
4753
|
-
target = vnode.elm;
|
4754
|
-
updateListeners(on, oldOn, add$
|
4814
|
+
target$1 = vnode.elm;
|
4815
|
+
updateListeners(on, oldOn, add$2, remove$3, vnode.context);
|
4755
4816
|
}
|
4756
4817
|
|
4757
4818
|
var events = {
|
@@ -4788,16 +4849,20 @@ function updateDOMProps (oldVnode, vnode) {
|
|
4788
4849
|
if (vnode.children) { vnode.children.length = 0; }
|
4789
4850
|
if (cur === oldProps[key]) { continue }
|
4790
4851
|
}
|
4852
|
+
// #4521: if a click event triggers update before the change event is
|
4853
|
+
// dispatched on a checkbox/radio input, the input's checked state will
|
4854
|
+
// be reset and fail to trigger another update.
|
4855
|
+
/* istanbul ignore next */
|
4856
|
+
if (key === 'checked' && !isDirty(elm, cur)) {
|
4857
|
+
continue
|
4858
|
+
}
|
4791
4859
|
if (key === 'value') {
|
4792
4860
|
// store value as _value as well since
|
4793
4861
|
// non-string values will be stringified
|
4794
4862
|
elm._value = cur;
|
4795
4863
|
// avoid resetting cursor position when value is the same
|
4796
4864
|
var strCur = cur == null ? '' : String(cur);
|
4797
|
-
if (
|
4798
|
-
(document.activeElement !== elm && elm.value !== strCur) ||
|
4799
|
-
isValueChanged(vnode, strCur)
|
4800
|
-
)) {
|
4865
|
+
if (shouldUpdateValue(elm, vnode, strCur)) {
|
4801
4866
|
elm.value = strCur;
|
4802
4867
|
}
|
4803
4868
|
} else {
|
@@ -4806,7 +4871,29 @@ function updateDOMProps (oldVnode, vnode) {
|
|
4806
4871
|
}
|
4807
4872
|
}
|
4808
4873
|
|
4809
|
-
|
4874
|
+
// check platforms/web/util/attrs.js acceptValue
|
4875
|
+
|
4876
|
+
|
4877
|
+
function shouldUpdateValue (
|
4878
|
+
elm,
|
4879
|
+
vnode,
|
4880
|
+
checkVal
|
4881
|
+
) {
|
4882
|
+
if (!elm.composing && (
|
4883
|
+
vnode.tag === 'option' ||
|
4884
|
+
isDirty(elm, checkVal) ||
|
4885
|
+
isInputChanged(vnode, checkVal)
|
4886
|
+
)) {
|
4887
|
+
return true
|
4888
|
+
}
|
4889
|
+
return false
|
4890
|
+
}
|
4891
|
+
|
4892
|
+
function isDirty (elm, checkVal) {
|
4893
|
+
return document.activeElement !== elm && elm.value !== checkVal
|
4894
|
+
}
|
4895
|
+
|
4896
|
+
function isInputChanged (vnode, newVal) {
|
4810
4897
|
var value = vnode.elm.value;
|
4811
4898
|
var modifiers = vnode.elm._vModifiers; // injected by v-model runtime
|
4812
4899
|
if ((modifiers && modifiers.number) || vnode.elm.type === 'number') {
|
@@ -5261,9 +5348,9 @@ function enter (vnode, toggleDisplay) {
|
|
5261
5348
|
beforeEnterHook && beforeEnterHook(el);
|
5262
5349
|
if (expectsCSS) {
|
5263
5350
|
addTransitionClass(el, startClass);
|
5264
|
-
addTransitionClass(el, activeClass);
|
5265
5351
|
nextFrame(function () {
|
5266
5352
|
removeTransitionClass(el, startClass);
|
5353
|
+
addTransitionClass(el, activeClass);
|
5267
5354
|
if (!cb.cancelled && !userWantsControl) {
|
5268
5355
|
whenTransitionEnds(el, type, cb);
|
5269
5356
|
}
|
@@ -5353,9 +5440,9 @@ function leave (vnode, rm) {
|
|
5353
5440
|
beforeLeave && beforeLeave(el);
|
5354
5441
|
if (expectsCSS) {
|
5355
5442
|
addTransitionClass(el, leaveClass);
|
5356
|
-
addTransitionClass(el, leaveActiveClass);
|
5357
5443
|
nextFrame(function () {
|
5358
5444
|
removeTransitionClass(el, leaveClass);
|
5445
|
+
addTransitionClass(el, leaveActiveClass);
|
5359
5446
|
if (!cb.cancelled && !userWantsControl) {
|
5360
5447
|
whenTransitionEnds(el, type, cb);
|
5361
5448
|
}
|
@@ -5601,6 +5688,7 @@ var show = {
|
|
5601
5688
|
el.style.display = value ? originalDisplay : 'none';
|
5602
5689
|
}
|
5603
5690
|
},
|
5691
|
+
|
5604
5692
|
update: function update (el, ref, vnode) {
|
5605
5693
|
var value = ref.value;
|
5606
5694
|
var oldValue = ref.oldValue;
|
@@ -5623,6 +5711,18 @@ var show = {
|
|
5623
5711
|
} else {
|
5624
5712
|
el.style.display = value ? el.__vOriginalDisplay : 'none';
|
5625
5713
|
}
|
5714
|
+
},
|
5715
|
+
|
5716
|
+
unbind: function unbind (
|
5717
|
+
el,
|
5718
|
+
binding,
|
5719
|
+
vnode,
|
5720
|
+
oldVnode,
|
5721
|
+
isDestroy
|
5722
|
+
) {
|
5723
|
+
if (!isDestroy) {
|
5724
|
+
el.style.display = el.__vOriginalDisplay;
|
5725
|
+
}
|
5626
5726
|
}
|
5627
5727
|
};
|
5628
5728
|
|
@@ -6758,7 +6858,7 @@ function parse (
|
|
6758
6858
|
"development" !== 'production' && warn$1(
|
6759
6859
|
'Templates should only be responsible for mapping the state to the ' +
|
6760
6860
|
'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
6761
|
-
"<" + tag + "
|
6861
|
+
"<" + tag + ">" + ', as they will not be parsed.'
|
6762
6862
|
);
|
6763
6863
|
}
|
6764
6864
|
|
@@ -6895,19 +6995,20 @@ function parse (
|
|
6895
6995
|
currentParent.attrsMap.placeholder === text) {
|
6896
6996
|
return
|
6897
6997
|
}
|
6998
|
+
var children = currentParent.children;
|
6898
6999
|
text = inPre || text.trim()
|
6899
7000
|
? decodeHTMLCached(text)
|
6900
7001
|
// only preserve whitespace if its not right after a starting tag
|
6901
|
-
: preserveWhitespace &&
|
7002
|
+
: preserveWhitespace && children.length ? ' ' : '';
|
6902
7003
|
if (text) {
|
6903
7004
|
var expression;
|
6904
7005
|
if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
|
6905
|
-
|
7006
|
+
children.push({
|
6906
7007
|
type: 2,
|
6907
7008
|
expression: expression,
|
6908
7009
|
text: text
|
6909
7010
|
});
|
6910
|
-
} else {
|
7011
|
+
} else if (text !== ' ' || children[children.length - 1].text !== ' ') {
|
6911
7012
|
currentParent.children.push({
|
6912
7013
|
type: 3,
|
6913
7014
|
text: text
|
@@ -7018,6 +7119,23 @@ function processIfConditions (el, parent) {
|
|
7018
7119
|
}
|
7019
7120
|
}
|
7020
7121
|
|
7122
|
+
function findPrevElement (children) {
|
7123
|
+
var i = children.length;
|
7124
|
+
while (i--) {
|
7125
|
+
if (children[i].type === 1) {
|
7126
|
+
return children[i]
|
7127
|
+
} else {
|
7128
|
+
if ("development" !== 'production' && children[i].text !== ' ') {
|
7129
|
+
warn$1(
|
7130
|
+
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
7131
|
+
"will be ignored."
|
7132
|
+
);
|
7133
|
+
}
|
7134
|
+
children.pop();
|
7135
|
+
}
|
7136
|
+
}
|
7137
|
+
}
|
7138
|
+
|
7021
7139
|
function addIfCondition (el, condition) {
|
7022
7140
|
if (!el.ifConditions) {
|
7023
7141
|
el.ifConditions = [];
|
@@ -7125,6 +7243,15 @@ function processAttrs (el) {
|
|
7125
7243
|
}
|
7126
7244
|
}
|
7127
7245
|
addAttr(el, name, JSON.stringify(value));
|
7246
|
+
// #4530 also bind special attributes as props even if they are static
|
7247
|
+
// so that patches between dynamic/static are consistent
|
7248
|
+
if (platformMustUseProp(el.tag, name)) {
|
7249
|
+
if (name === 'value') {
|
7250
|
+
addProp(el, name, JSON.stringify(value));
|
7251
|
+
} else {
|
7252
|
+
addProp(el, name, 'true');
|
7253
|
+
}
|
7254
|
+
}
|
7128
7255
|
}
|
7129
7256
|
}
|
7130
7257
|
}
|
@@ -7160,13 +7287,6 @@ function makeAttrsMap (attrs) {
|
|
7160
7287
|
return map
|
7161
7288
|
}
|
7162
7289
|
|
7163
|
-
function findPrevElement (children) {
|
7164
|
-
var i = children.length;
|
7165
|
-
while (i--) {
|
7166
|
-
if (children[i].tag) { return children[i] }
|
7167
|
-
}
|
7168
|
-
}
|
7169
|
-
|
7170
7290
|
function isForbiddenTag (el) {
|
7171
7291
|
return (
|
7172
7292
|
el.tag === 'style' ||
|
@@ -7432,6 +7552,7 @@ var warn$2;
|
|
7432
7552
|
var transforms$1;
|
7433
7553
|
var dataGenFns;
|
7434
7554
|
var platformDirectives$1;
|
7555
|
+
var isPlatformReservedTag$1;
|
7435
7556
|
var staticRenderFns;
|
7436
7557
|
var onceCount;
|
7437
7558
|
var currentOptions;
|
@@ -7450,6 +7571,7 @@ function generate (
|
|
7450
7571
|
transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
|
7451
7572
|
dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
7452
7573
|
platformDirectives$1 = options.directives || {};
|
7574
|
+
isPlatformReservedTag$1 = options.isReservedTag || no;
|
7453
7575
|
var code = ast ? genElement(ast) : '_c("div")';
|
7454
7576
|
staticRenderFns = prevStaticRenderFns;
|
7455
7577
|
onceCount = prevOnceCount;
|
@@ -7689,27 +7811,40 @@ function genChildren (el, checkSkip) {
|
|
7689
7811
|
el$1.tag !== 'slot') {
|
7690
7812
|
return genElement(el$1)
|
7691
7813
|
}
|
7814
|
+
var normalizationType = getNormalizationType(children);
|
7692
7815
|
return ("[" + (children.map(genNode).join(',')) + "]" + (checkSkip
|
7693
|
-
?
|
7816
|
+
? normalizationType ? ("," + normalizationType) : ''
|
7694
7817
|
: ''))
|
7695
7818
|
}
|
7696
7819
|
}
|
7697
7820
|
|
7698
|
-
|
7821
|
+
// determine the normalzation needed for the children array.
|
7822
|
+
// 0: no normalization needed
|
7823
|
+
// 1: simple normalization needed (possible 1-level deep nested array)
|
7824
|
+
// 2: full nomralization needed
|
7825
|
+
function getNormalizationType (children) {
|
7699
7826
|
for (var i = 0; i < children.length; i++) {
|
7700
7827
|
var el = children[i];
|
7701
7828
|
if (needsNormalization(el) ||
|
7702
7829
|
(el.if && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
7703
|
-
return
|
7830
|
+
return 2
|
7831
|
+
}
|
7832
|
+
if (maybeComponent(el) ||
|
7833
|
+
(el.if && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
7834
|
+
return 1
|
7704
7835
|
}
|
7705
7836
|
}
|
7706
|
-
return
|
7837
|
+
return 0
|
7707
7838
|
}
|
7708
7839
|
|
7709
7840
|
function needsNormalization (el) {
|
7710
7841
|
return el.for || el.tag === 'template' || el.tag === 'slot'
|
7711
7842
|
}
|
7712
7843
|
|
7844
|
+
function maybeComponent (el) {
|
7845
|
+
return el.type === 1 && !isPlatformReservedTag$1(el.tag)
|
7846
|
+
}
|
7847
|
+
|
7713
7848
|
function genNode (node) {
|
7714
7849
|
if (node.type === 1) {
|
7715
7850
|
return genElement(node)
|
@@ -7727,7 +7862,19 @@ function genText (text) {
|
|
7727
7862
|
function genSlot (el) {
|
7728
7863
|
var slotName = el.slotName || '"default"';
|
7729
7864
|
var children = genChildren(el);
|
7730
|
-
|
7865
|
+
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
7866
|
+
var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
|
7867
|
+
var bind$$1 = el.attrsMap['v-bind'];
|
7868
|
+
if ((attrs || bind$$1) && !children) {
|
7869
|
+
res += ",null";
|
7870
|
+
}
|
7871
|
+
if (attrs) {
|
7872
|
+
res += "," + attrs;
|
7873
|
+
}
|
7874
|
+
if (bind$$1) {
|
7875
|
+
res += (attrs ? '' : ',null') + "," + bind$$1;
|
7876
|
+
}
|
7877
|
+
return res + ')'
|
7731
7878
|
}
|
7732
7879
|
|
7733
7880
|
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|