vuejs-rails 2.1.6 → 2.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/Readme.md +3 -3
- data/lib/vuejs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/vue-router.js +861 -643
- data/vendor/assets/javascripts/vue.js +1976 -1734
- metadata +2 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Vue.js v2.1.
|
3
|
-
* (c) 2014-
|
2
|
+
* Vue.js v2.1.10
|
3
|
+
* (c) 2014-2017 Evan You
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
@@ -27,8 +27,8 @@ function _toString (val) {
|
|
27
27
|
* If the conversion fails, return original string.
|
28
28
|
*/
|
29
29
|
function toNumber (val) {
|
30
|
-
var n = parseFloat(val
|
31
|
-
return (n
|
30
|
+
var n = parseFloat(val);
|
31
|
+
return isNaN(n) ? val : n
|
32
32
|
}
|
33
33
|
|
34
34
|
/**
|
@@ -86,14 +86,14 @@ function isPrimitive (value) {
|
|
86
86
|
*/
|
87
87
|
function cached (fn) {
|
88
88
|
var cache = Object.create(null);
|
89
|
-
return function cachedFn (str) {
|
89
|
+
return (function cachedFn (str) {
|
90
90
|
var hit = cache[str];
|
91
91
|
return hit || (cache[str] = fn(str))
|
92
|
-
}
|
92
|
+
})
|
93
93
|
}
|
94
94
|
|
95
95
|
/**
|
96
|
-
* Camelize a hyphen-
|
96
|
+
* Camelize a hyphen-delimited string.
|
97
97
|
*/
|
98
98
|
var camelizeRE = /-(\w)/g;
|
99
99
|
var camelize = cached(function (str) {
|
@@ -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
|
}
|
@@ -1299,7 +1304,7 @@ function assertProp (
|
|
1299
1304
|
}
|
1300
1305
|
for (var i = 0; i < type.length && !valid; i++) {
|
1301
1306
|
var assertedType = assertType(value, type[i]);
|
1302
|
-
expectedTypes.push(assertedType.expectedType);
|
1307
|
+
expectedTypes.push(assertedType.expectedType || '');
|
1303
1308
|
valid = assertedType.valid;
|
1304
1309
|
}
|
1305
1310
|
}
|
@@ -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
|
}
|
@@ -1376,50 +1381,50 @@ function isBooleanType (fn) {
|
|
1376
1381
|
|
1377
1382
|
|
1378
1383
|
var util = Object.freeze({
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1384
|
+
defineReactive: defineReactive$$1,
|
1385
|
+
_toString: _toString,
|
1386
|
+
toNumber: toNumber,
|
1387
|
+
makeMap: makeMap,
|
1388
|
+
isBuiltInTag: isBuiltInTag,
|
1389
|
+
remove: remove$1,
|
1390
|
+
hasOwn: hasOwn,
|
1391
|
+
isPrimitive: isPrimitive,
|
1392
|
+
cached: cached,
|
1393
|
+
camelize: camelize,
|
1394
|
+
capitalize: capitalize,
|
1395
|
+
hyphenate: hyphenate,
|
1396
|
+
bind: bind$1,
|
1397
|
+
toArray: toArray,
|
1398
|
+
extend: extend,
|
1399
|
+
isObject: isObject,
|
1400
|
+
isPlainObject: isPlainObject,
|
1401
|
+
toObject: toObject,
|
1402
|
+
noop: noop,
|
1403
|
+
no: no,
|
1404
|
+
identity: identity,
|
1405
|
+
genStaticKeys: genStaticKeys,
|
1406
|
+
looseEqual: looseEqual,
|
1407
|
+
looseIndexOf: looseIndexOf,
|
1408
|
+
isReserved: isReserved,
|
1409
|
+
def: def,
|
1410
|
+
parsePath: parsePath,
|
1411
|
+
hasProto: hasProto,
|
1412
|
+
inBrowser: inBrowser,
|
1413
|
+
UA: UA,
|
1414
|
+
isIE: isIE,
|
1415
|
+
isIE9: isIE9,
|
1416
|
+
isEdge: isEdge,
|
1417
|
+
isAndroid: isAndroid,
|
1418
|
+
isIOS: isIOS,
|
1419
|
+
isServerRendering: isServerRendering,
|
1420
|
+
devtools: devtools,
|
1421
|
+
nextTick: nextTick,
|
1422
|
+
get _Set () { return _Set; },
|
1423
|
+
mergeOptions: mergeOptions,
|
1424
|
+
resolveAsset: resolveAsset,
|
1425
|
+
get warn () { return warn; },
|
1426
|
+
get formatComponentName () { return formatComponentName; },
|
1427
|
+
validateProp: validateProp
|
1423
1428
|
});
|
1424
1429
|
|
1425
1430
|
/* not type checking this file because flow doesn't play well with Proxy */
|
@@ -1498,1764 +1503,1840 @@ var initProxy;
|
|
1498
1503
|
|
1499
1504
|
/* */
|
1500
1505
|
|
1506
|
+
var VNode = function VNode (
|
1507
|
+
tag,
|
1508
|
+
data,
|
1509
|
+
children,
|
1510
|
+
text,
|
1511
|
+
elm,
|
1512
|
+
context,
|
1513
|
+
componentOptions
|
1514
|
+
) {
|
1515
|
+
this.tag = tag;
|
1516
|
+
this.data = data;
|
1517
|
+
this.children = children;
|
1518
|
+
this.text = text;
|
1519
|
+
this.elm = elm;
|
1520
|
+
this.ns = undefined;
|
1521
|
+
this.context = context;
|
1522
|
+
this.functionalContext = undefined;
|
1523
|
+
this.key = data && data.key;
|
1524
|
+
this.componentOptions = componentOptions;
|
1525
|
+
this.componentInstance = undefined;
|
1526
|
+
this.parent = undefined;
|
1527
|
+
this.raw = false;
|
1528
|
+
this.isStatic = false;
|
1529
|
+
this.isRootInsert = true;
|
1530
|
+
this.isComment = false;
|
1531
|
+
this.isCloned = false;
|
1532
|
+
this.isOnce = false;
|
1533
|
+
};
|
1501
1534
|
|
1502
|
-
var
|
1503
|
-
var has$1 = {};
|
1504
|
-
var circular = {};
|
1505
|
-
var waiting = false;
|
1506
|
-
var flushing = false;
|
1507
|
-
var index = 0;
|
1508
|
-
|
1509
|
-
/**
|
1510
|
-
* Reset the scheduler's state.
|
1511
|
-
*/
|
1512
|
-
function resetSchedulerState () {
|
1513
|
-
queue.length = 0;
|
1514
|
-
has$1 = {};
|
1515
|
-
{
|
1516
|
-
circular = {};
|
1517
|
-
}
|
1518
|
-
waiting = flushing = false;
|
1519
|
-
}
|
1535
|
+
var prototypeAccessors = { child: {} };
|
1520
1536
|
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1537
|
+
// DEPRECATED: alias for componentInstance for backwards compat.
|
1538
|
+
/* istanbul ignore next */
|
1539
|
+
prototypeAccessors.child.get = function () {
|
1540
|
+
return this.componentInstance
|
1541
|
+
};
|
1526
1542
|
|
1527
|
-
|
1528
|
-
// This ensures that:
|
1529
|
-
// 1. Components are updated from parent to child. (because parent is always
|
1530
|
-
// created before the child)
|
1531
|
-
// 2. A component's user watchers are run before its render watcher (because
|
1532
|
-
// user watchers are created before the render watcher)
|
1533
|
-
// 3. If a component is destroyed during a parent component's watcher run,
|
1534
|
-
// its watchers can be skipped.
|
1535
|
-
queue.sort(function (a, b) { return a.id - b.id; });
|
1543
|
+
Object.defineProperties( VNode.prototype, prototypeAccessors );
|
1536
1544
|
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
watcher.run();
|
1544
|
-
// in dev build, check and stop circular updates.
|
1545
|
-
if ("development" !== 'production' && has$1[id] != null) {
|
1546
|
-
circular[id] = (circular[id] || 0) + 1;
|
1547
|
-
if (circular[id] > config._maxUpdateCount) {
|
1548
|
-
warn(
|
1549
|
-
'You may have an infinite update loop ' + (
|
1550
|
-
watcher.user
|
1551
|
-
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
1552
|
-
: "in a component render function."
|
1553
|
-
),
|
1554
|
-
watcher.vm
|
1555
|
-
);
|
1556
|
-
break
|
1557
|
-
}
|
1558
|
-
}
|
1559
|
-
}
|
1545
|
+
var createEmptyVNode = function () {
|
1546
|
+
var node = new VNode();
|
1547
|
+
node.text = '';
|
1548
|
+
node.isComment = true;
|
1549
|
+
return node
|
1550
|
+
};
|
1560
1551
|
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
devtools.emit('flush');
|
1565
|
-
}
|
1552
|
+
function createTextVNode (val) {
|
1553
|
+
return new VNode(undefined, undefined, undefined, String(val))
|
1554
|
+
}
|
1566
1555
|
|
1567
|
-
|
1556
|
+
// optimized shallow clone
|
1557
|
+
// used for static nodes and slot nodes because they may be reused across
|
1558
|
+
// multiple renders, cloning them avoids errors when DOM manipulations rely
|
1559
|
+
// on their elm reference.
|
1560
|
+
function cloneVNode (vnode) {
|
1561
|
+
var cloned = new VNode(
|
1562
|
+
vnode.tag,
|
1563
|
+
vnode.data,
|
1564
|
+
vnode.children,
|
1565
|
+
vnode.text,
|
1566
|
+
vnode.elm,
|
1567
|
+
vnode.context,
|
1568
|
+
vnode.componentOptions
|
1569
|
+
);
|
1570
|
+
cloned.ns = vnode.ns;
|
1571
|
+
cloned.isStatic = vnode.isStatic;
|
1572
|
+
cloned.key = vnode.key;
|
1573
|
+
cloned.isCloned = true;
|
1574
|
+
return cloned
|
1568
1575
|
}
|
1569
1576
|
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
*/
|
1575
|
-
function queueWatcher (watcher) {
|
1576
|
-
var id = watcher.id;
|
1577
|
-
if (has$1[id] == null) {
|
1578
|
-
has$1[id] = true;
|
1579
|
-
if (!flushing) {
|
1580
|
-
queue.push(watcher);
|
1581
|
-
} else {
|
1582
|
-
// if already flushing, splice the watcher based on its id
|
1583
|
-
// if already past its id, it will be run next immediately.
|
1584
|
-
var i = queue.length - 1;
|
1585
|
-
while (i >= 0 && queue[i].id > watcher.id) {
|
1586
|
-
i--;
|
1587
|
-
}
|
1588
|
-
queue.splice(Math.max(i, index) + 1, 0, watcher);
|
1589
|
-
}
|
1590
|
-
// queue the flush
|
1591
|
-
if (!waiting) {
|
1592
|
-
waiting = true;
|
1593
|
-
nextTick(flushSchedulerQueue);
|
1594
|
-
}
|
1577
|
+
function cloneVNodes (vnodes) {
|
1578
|
+
var res = new Array(vnodes.length);
|
1579
|
+
for (var i = 0; i < vnodes.length; i++) {
|
1580
|
+
res[i] = cloneVNode(vnodes[i]);
|
1595
1581
|
}
|
1582
|
+
return res
|
1596
1583
|
}
|
1597
1584
|
|
1598
1585
|
/* */
|
1599
1586
|
|
1600
|
-
var
|
1587
|
+
var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 };
|
1588
|
+
var hooksToMerge = Object.keys(hooks);
|
1601
1589
|
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
vm,
|
1609
|
-
expOrFn,
|
1610
|
-
cb,
|
1611
|
-
options
|
1590
|
+
function createComponent (
|
1591
|
+
Ctor,
|
1592
|
+
data,
|
1593
|
+
context,
|
1594
|
+
children,
|
1595
|
+
tag
|
1612
1596
|
) {
|
1613
|
-
if (
|
1597
|
+
if (!Ctor) {
|
1598
|
+
return
|
1599
|
+
}
|
1614
1600
|
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
this.deep = !!options.deep;
|
1619
|
-
this.user = !!options.user;
|
1620
|
-
this.lazy = !!options.lazy;
|
1621
|
-
this.sync = !!options.sync;
|
1622
|
-
this.expression = expOrFn.toString();
|
1623
|
-
this.cb = cb;
|
1624
|
-
this.id = ++uid$2; // uid for batching
|
1625
|
-
this.active = true;
|
1626
|
-
this.dirty = this.lazy; // for lazy watchers
|
1627
|
-
this.deps = [];
|
1628
|
-
this.newDeps = [];
|
1629
|
-
this.depIds = new _Set();
|
1630
|
-
this.newDepIds = new _Set();
|
1631
|
-
// parse expression for getter
|
1632
|
-
if (typeof expOrFn === 'function') {
|
1633
|
-
this.getter = expOrFn;
|
1634
|
-
} else {
|
1635
|
-
this.getter = parsePath(expOrFn);
|
1636
|
-
if (!this.getter) {
|
1637
|
-
this.getter = function () {};
|
1638
|
-
"development" !== 'production' && warn(
|
1639
|
-
"Failed watching path: \"" + expOrFn + "\" " +
|
1640
|
-
'Watcher only accepts simple dot-delimited paths. ' +
|
1641
|
-
'For full control, use a function instead.',
|
1642
|
-
vm
|
1643
|
-
);
|
1644
|
-
}
|
1601
|
+
var baseCtor = context.$options._base;
|
1602
|
+
if (isObject(Ctor)) {
|
1603
|
+
Ctor = baseCtor.extend(Ctor);
|
1645
1604
|
}
|
1646
|
-
this.value = this.lazy
|
1647
|
-
? undefined
|
1648
|
-
: this.get();
|
1649
|
-
};
|
1650
1605
|
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
var value = this.getter.call(this.vm, this.vm);
|
1657
|
-
// "touch" every property so they are all tracked as
|
1658
|
-
// dependencies for deep watching
|
1659
|
-
if (this.deep) {
|
1660
|
-
traverse(value);
|
1606
|
+
if (typeof Ctor !== 'function') {
|
1607
|
+
{
|
1608
|
+
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
1609
|
+
}
|
1610
|
+
return
|
1661
1611
|
}
|
1662
|
-
popTarget();
|
1663
|
-
this.cleanupDeps();
|
1664
|
-
return value
|
1665
|
-
};
|
1666
1612
|
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1613
|
+
// async component
|
1614
|
+
if (!Ctor.cid) {
|
1615
|
+
if (Ctor.resolved) {
|
1616
|
+
Ctor = Ctor.resolved;
|
1617
|
+
} else {
|
1618
|
+
Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
|
1619
|
+
// it's ok to queue this on every render because
|
1620
|
+
// $forceUpdate is buffered by the scheduler.
|
1621
|
+
context.$forceUpdate();
|
1622
|
+
});
|
1623
|
+
if (!Ctor) {
|
1624
|
+
// return nothing if this is indeed an async component
|
1625
|
+
// wait for the callback to trigger parent update.
|
1626
|
+
return
|
1627
|
+
}
|
1677
1628
|
}
|
1678
1629
|
}
|
1679
|
-
};
|
1680
1630
|
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
1685
|
-
var this$1 = this;
|
1631
|
+
// resolve constructor options in case global mixins are applied after
|
1632
|
+
// component constructor creation
|
1633
|
+
resolveConstructorOptions(Ctor);
|
1686
1634
|
|
1687
|
-
|
1688
|
-
while (i--) {
|
1689
|
-
var dep = this$1.deps[i];
|
1690
|
-
if (!this$1.newDepIds.has(dep.id)) {
|
1691
|
-
dep.removeSub(this$1);
|
1692
|
-
}
|
1693
|
-
}
|
1694
|
-
var tmp = this.depIds;
|
1695
|
-
this.depIds = this.newDepIds;
|
1696
|
-
this.newDepIds = tmp;
|
1697
|
-
this.newDepIds.clear();
|
1698
|
-
tmp = this.deps;
|
1699
|
-
this.deps = this.newDeps;
|
1700
|
-
this.newDeps = tmp;
|
1701
|
-
this.newDeps.length = 0;
|
1702
|
-
};
|
1635
|
+
data = data || {};
|
1703
1636
|
|
1704
|
-
|
1705
|
-
|
1706
|
-
* Will be called when a dependency changes.
|
1707
|
-
*/
|
1708
|
-
Watcher.prototype.update = function update () {
|
1709
|
-
/* istanbul ignore else */
|
1710
|
-
if (this.lazy) {
|
1711
|
-
this.dirty = true;
|
1712
|
-
} else if (this.sync) {
|
1713
|
-
this.run();
|
1714
|
-
} else {
|
1715
|
-
queueWatcher(this);
|
1716
|
-
}
|
1717
|
-
};
|
1637
|
+
// extract props
|
1638
|
+
var propsData = extractProps(data, Ctor);
|
1718
1639
|
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
*/
|
1723
|
-
Watcher.prototype.run = function run () {
|
1724
|
-
if (this.active) {
|
1725
|
-
var value = this.get();
|
1726
|
-
if (
|
1727
|
-
value !== this.value ||
|
1728
|
-
// Deep watchers and watchers on Object/Arrays should fire even
|
1729
|
-
// when the value is the same, because the value may
|
1730
|
-
// have mutated.
|
1731
|
-
isObject(value) ||
|
1732
|
-
this.deep
|
1733
|
-
) {
|
1734
|
-
// set new value
|
1735
|
-
var oldValue = this.value;
|
1736
|
-
this.value = value;
|
1737
|
-
if (this.user) {
|
1738
|
-
try {
|
1739
|
-
this.cb.call(this.vm, value, oldValue);
|
1740
|
-
} catch (e) {
|
1741
|
-
/* istanbul ignore else */
|
1742
|
-
if (config.errorHandler) {
|
1743
|
-
config.errorHandler.call(null, e, this.vm);
|
1744
|
-
} else {
|
1745
|
-
"development" !== 'production' && warn(
|
1746
|
-
("Error in watcher \"" + (this.expression) + "\""),
|
1747
|
-
this.vm
|
1748
|
-
);
|
1749
|
-
throw e
|
1750
|
-
}
|
1751
|
-
}
|
1752
|
-
} else {
|
1753
|
-
this.cb.call(this.vm, value, oldValue);
|
1754
|
-
}
|
1755
|
-
}
|
1640
|
+
// functional component
|
1641
|
+
if (Ctor.options.functional) {
|
1642
|
+
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
1756
1643
|
}
|
1757
|
-
};
|
1758
|
-
|
1759
|
-
/**
|
1760
|
-
* Evaluate the value of the watcher.
|
1761
|
-
* This only gets called for lazy watchers.
|
1762
|
-
*/
|
1763
|
-
Watcher.prototype.evaluate = function evaluate () {
|
1764
|
-
this.value = this.get();
|
1765
|
-
this.dirty = false;
|
1766
|
-
};
|
1767
1644
|
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1645
|
+
// extract listeners, since these needs to be treated as
|
1646
|
+
// child component listeners instead of DOM listeners
|
1647
|
+
var listeners = data.on;
|
1648
|
+
// replace with listeners with .native modifier
|
1649
|
+
data.on = data.nativeOn;
|
1773
1650
|
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1651
|
+
if (Ctor.options.abstract) {
|
1652
|
+
// abstract components do not keep anything
|
1653
|
+
// other than props & listeners
|
1654
|
+
data = {};
|
1777
1655
|
}
|
1778
|
-
};
|
1779
1656
|
|
1780
|
-
|
1781
|
-
|
1782
|
-
*/
|
1783
|
-
Watcher.prototype.teardown = function teardown () {
|
1784
|
-
var this$1 = this;
|
1657
|
+
// merge component management hooks onto the placeholder node
|
1658
|
+
mergeHooks(data);
|
1785
1659
|
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1660
|
+
// return a placeholder vnode
|
1661
|
+
var name = Ctor.options.name || tag;
|
1662
|
+
var vnode = new VNode(
|
1663
|
+
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
1664
|
+
data, undefined, undefined, undefined, context,
|
1665
|
+
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
|
1666
|
+
);
|
1667
|
+
return vnode
|
1668
|
+
}
|
1669
|
+
|
1670
|
+
function createFunctionalComponent (
|
1671
|
+
Ctor,
|
1672
|
+
propsData,
|
1673
|
+
data,
|
1674
|
+
context,
|
1675
|
+
children
|
1676
|
+
) {
|
1677
|
+
var props = {};
|
1678
|
+
var propOptions = Ctor.options.props;
|
1679
|
+
if (propOptions) {
|
1680
|
+
for (var key in propOptions) {
|
1681
|
+
props[key] = validateProp(key, propOptions, propsData);
|
1793
1682
|
}
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1683
|
+
}
|
1684
|
+
// ensure the createElement function in functional components
|
1685
|
+
// gets a unique context - this is necessary for correct named slot check
|
1686
|
+
var _context = Object.create(context);
|
1687
|
+
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
|
1688
|
+
var vnode = Ctor.options.render.call(null, h, {
|
1689
|
+
props: props,
|
1690
|
+
data: data,
|
1691
|
+
parent: context,
|
1692
|
+
children: children,
|
1693
|
+
slots: function () { return resolveSlots(children, context); }
|
1694
|
+
});
|
1695
|
+
if (vnode instanceof VNode) {
|
1696
|
+
vnode.functionalContext = context;
|
1697
|
+
if (data.slot) {
|
1698
|
+
(vnode.data || (vnode.data = {})).slot = data.slot;
|
1797
1699
|
}
|
1798
|
-
this.active = false;
|
1799
1700
|
}
|
1800
|
-
|
1801
|
-
|
1802
|
-
/**
|
1803
|
-
* Recursively traverse an object to evoke all converted
|
1804
|
-
* getters, so that every nested property inside the object
|
1805
|
-
* is collected as a "deep" dependency.
|
1806
|
-
*/
|
1807
|
-
var seenObjects = new _Set();
|
1808
|
-
function traverse (val) {
|
1809
|
-
seenObjects.clear();
|
1810
|
-
_traverse(val, seenObjects);
|
1701
|
+
return vnode
|
1811
1702
|
}
|
1812
1703
|
|
1813
|
-
function
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1704
|
+
function createComponentInstanceForVnode (
|
1705
|
+
vnode, // we know it's MountedComponentVNode but flow doesn't
|
1706
|
+
parent, // activeInstance in lifecycle state
|
1707
|
+
parentElm,
|
1708
|
+
refElm
|
1709
|
+
) {
|
1710
|
+
var vnodeComponentOptions = vnode.componentOptions;
|
1711
|
+
var options = {
|
1712
|
+
_isComponent: true,
|
1713
|
+
parent: parent,
|
1714
|
+
propsData: vnodeComponentOptions.propsData,
|
1715
|
+
_componentTag: vnodeComponentOptions.tag,
|
1716
|
+
_parentVnode: vnode,
|
1717
|
+
_parentListeners: vnodeComponentOptions.listeners,
|
1718
|
+
_renderChildren: vnodeComponentOptions.children,
|
1719
|
+
_parentElm: parentElm || null,
|
1720
|
+
_refElm: refElm || null
|
1721
|
+
};
|
1722
|
+
// check inline-template render functions
|
1723
|
+
var inlineTemplate = vnode.data.inlineTemplate;
|
1724
|
+
if (inlineTemplate) {
|
1725
|
+
options.render = inlineTemplate.render;
|
1726
|
+
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
1825
1727
|
}
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1728
|
+
return new vnodeComponentOptions.Ctor(options)
|
1729
|
+
}
|
1730
|
+
|
1731
|
+
function init (
|
1732
|
+
vnode,
|
1733
|
+
hydrating,
|
1734
|
+
parentElm,
|
1735
|
+
refElm
|
1736
|
+
) {
|
1737
|
+
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
|
1738
|
+
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
1739
|
+
vnode,
|
1740
|
+
activeInstance,
|
1741
|
+
parentElm,
|
1742
|
+
refElm
|
1743
|
+
);
|
1744
|
+
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
1745
|
+
} else if (vnode.data.keepAlive) {
|
1746
|
+
// kept-alive components, treat as a patch
|
1747
|
+
var mountedNode = vnode; // work around flow
|
1748
|
+
prepatch(mountedNode, mountedNode);
|
1833
1749
|
}
|
1834
1750
|
}
|
1835
1751
|
|
1836
|
-
|
1752
|
+
function prepatch (
|
1753
|
+
oldVnode,
|
1754
|
+
vnode
|
1755
|
+
) {
|
1756
|
+
var options = vnode.componentOptions;
|
1757
|
+
var child = vnode.componentInstance = oldVnode.componentInstance;
|
1758
|
+
child._updateFromParent(
|
1759
|
+
options.propsData, // updated props
|
1760
|
+
options.listeners, // updated listeners
|
1761
|
+
vnode, // new parent vnode
|
1762
|
+
options.children // new children
|
1763
|
+
);
|
1764
|
+
}
|
1837
1765
|
|
1838
|
-
function
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1766
|
+
function insert (vnode) {
|
1767
|
+
if (!vnode.componentInstance._isMounted) {
|
1768
|
+
vnode.componentInstance._isMounted = true;
|
1769
|
+
callHook(vnode.componentInstance, 'mounted');
|
1770
|
+
}
|
1771
|
+
if (vnode.data.keepAlive) {
|
1772
|
+
vnode.componentInstance._inactive = false;
|
1773
|
+
callHook(vnode.componentInstance, 'activated');
|
1774
|
+
}
|
1845
1775
|
}
|
1846
1776
|
|
1847
|
-
|
1777
|
+
function destroy$1 (vnode) {
|
1778
|
+
if (!vnode.componentInstance._isDestroyed) {
|
1779
|
+
if (!vnode.data.keepAlive) {
|
1780
|
+
vnode.componentInstance.$destroy();
|
1781
|
+
} else {
|
1782
|
+
vnode.componentInstance._inactive = true;
|
1783
|
+
callHook(vnode.componentInstance, 'deactivated');
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
}
|
1848
1787
|
|
1849
|
-
function
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
//
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1788
|
+
function resolveAsyncComponent (
|
1789
|
+
factory,
|
1790
|
+
baseCtor,
|
1791
|
+
cb
|
1792
|
+
) {
|
1793
|
+
if (factory.requested) {
|
1794
|
+
// pool callbacks
|
1795
|
+
factory.pendingCallbacks.push(cb);
|
1796
|
+
} else {
|
1797
|
+
factory.requested = true;
|
1798
|
+
var cbs = factory.pendingCallbacks = [cb];
|
1799
|
+
var sync = true;
|
1800
|
+
|
1801
|
+
var resolve = function (res) {
|
1802
|
+
if (isObject(res)) {
|
1803
|
+
res = baseCtor.extend(res);
|
1804
|
+
}
|
1805
|
+
// cache resolved
|
1806
|
+
factory.resolved = res;
|
1807
|
+
// invoke callbacks only if this is not a synchronous resolve
|
1808
|
+
// (async resolves are shimmed as synchronous during SSR)
|
1809
|
+
if (!sync) {
|
1810
|
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
1811
|
+
cbs[i](res);
|
1866
1812
|
}
|
1867
|
-
defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
|
1868
|
-
if (vm.$parent && !observerState.isSettingProps) {
|
1869
|
-
warn(
|
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
1813
|
}
|
1879
1814
|
};
|
1880
1815
|
|
1881
|
-
|
1882
|
-
observerState.shouldConvert = true;
|
1883
|
-
}
|
1884
|
-
}
|
1885
|
-
|
1886
|
-
function initData (vm) {
|
1887
|
-
var data = vm.$options.data;
|
1888
|
-
data = vm._data = typeof data === 'function'
|
1889
|
-
? data.call(vm)
|
1890
|
-
: data || {};
|
1891
|
-
if (!isPlainObject(data)) {
|
1892
|
-
data = {};
|
1893
|
-
"development" !== 'production' && warn(
|
1894
|
-
'data functions should return an object:\n' +
|
1895
|
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
1896
|
-
vm
|
1897
|
-
);
|
1898
|
-
}
|
1899
|
-
// proxy data on instance
|
1900
|
-
var keys = Object.keys(data);
|
1901
|
-
var props = vm.$options.props;
|
1902
|
-
var i = keys.length;
|
1903
|
-
while (i--) {
|
1904
|
-
if (props && hasOwn(props, keys[i])) {
|
1816
|
+
var reject = function (reason) {
|
1905
1817
|
"development" !== 'production' && warn(
|
1906
|
-
"
|
1907
|
-
"
|
1908
|
-
vm
|
1818
|
+
"Failed to resolve async component: " + (String(factory)) +
|
1819
|
+
(reason ? ("\nReason: " + reason) : '')
|
1909
1820
|
);
|
1910
|
-
}
|
1911
|
-
proxy(vm, keys[i]);
|
1912
|
-
}
|
1913
|
-
}
|
1914
|
-
// observe data
|
1915
|
-
observe(data);
|
1916
|
-
data.__ob__ && data.__ob__.vmCount++;
|
1917
|
-
}
|
1821
|
+
};
|
1918
1822
|
|
1919
|
-
var
|
1920
|
-
enumerable: true,
|
1921
|
-
configurable: true,
|
1922
|
-
get: noop,
|
1923
|
-
set: noop
|
1924
|
-
};
|
1823
|
+
var res = factory(resolve, reject);
|
1925
1824
|
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
for (var key in computed) {
|
1930
|
-
var userDef = computed[key];
|
1931
|
-
if (typeof userDef === 'function') {
|
1932
|
-
computedSharedDefinition.get = makeComputedGetter(userDef, vm);
|
1933
|
-
computedSharedDefinition.set = noop;
|
1934
|
-
} else {
|
1935
|
-
computedSharedDefinition.get = userDef.get
|
1936
|
-
? userDef.cache !== false
|
1937
|
-
? makeComputedGetter(userDef.get, vm)
|
1938
|
-
: bind$1(userDef.get, vm)
|
1939
|
-
: noop;
|
1940
|
-
computedSharedDefinition.set = userDef.set
|
1941
|
-
? bind$1(userDef.set, vm)
|
1942
|
-
: noop;
|
1943
|
-
}
|
1944
|
-
Object.defineProperty(vm, key, computedSharedDefinition);
|
1825
|
+
// handle promise
|
1826
|
+
if (res && typeof res.then === 'function' && !factory.resolved) {
|
1827
|
+
res.then(resolve, reject);
|
1945
1828
|
}
|
1829
|
+
|
1830
|
+
sync = false;
|
1831
|
+
// return in case resolved synchronously
|
1832
|
+
return factory.resolved
|
1946
1833
|
}
|
1947
1834
|
}
|
1948
1835
|
|
1949
|
-
function
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1836
|
+
function extractProps (data, Ctor) {
|
1837
|
+
// we are only extracting raw values here.
|
1838
|
+
// validation and default values are handled in the child
|
1839
|
+
// component itself.
|
1840
|
+
var propOptions = Ctor.options.props;
|
1841
|
+
if (!propOptions) {
|
1842
|
+
return
|
1843
|
+
}
|
1844
|
+
var res = {};
|
1845
|
+
var attrs = data.attrs;
|
1846
|
+
var props = data.props;
|
1847
|
+
var domProps = data.domProps;
|
1848
|
+
if (attrs || props || domProps) {
|
1849
|
+
for (var key in propOptions) {
|
1850
|
+
var altKey = hyphenate(key);
|
1851
|
+
checkProp(res, props, key, altKey, true) ||
|
1852
|
+
checkProp(res, attrs, key, altKey) ||
|
1853
|
+
checkProp(res, domProps, key, altKey);
|
1959
1854
|
}
|
1960
|
-
return watcher.value
|
1961
1855
|
}
|
1856
|
+
return res
|
1962
1857
|
}
|
1963
1858
|
|
1964
|
-
function
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1859
|
+
function checkProp (
|
1860
|
+
res,
|
1861
|
+
hash,
|
1862
|
+
key,
|
1863
|
+
altKey,
|
1864
|
+
preserve
|
1865
|
+
) {
|
1866
|
+
if (hash) {
|
1867
|
+
if (hasOwn(hash, key)) {
|
1868
|
+
res[key] = hash[key];
|
1869
|
+
if (!preserve) {
|
1870
|
+
delete hash[key];
|
1871
|
+
}
|
1872
|
+
return true
|
1873
|
+
} else if (hasOwn(hash, altKey)) {
|
1874
|
+
res[key] = hash[altKey];
|
1875
|
+
if (!preserve) {
|
1876
|
+
delete hash[altKey];
|
1975
1877
|
}
|
1878
|
+
return true
|
1976
1879
|
}
|
1977
1880
|
}
|
1881
|
+
return false
|
1978
1882
|
}
|
1979
1883
|
|
1980
|
-
function
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
} else {
|
1990
|
-
createWatcher(vm, key, handler);
|
1991
|
-
}
|
1992
|
-
}
|
1884
|
+
function mergeHooks (data) {
|
1885
|
+
if (!data.hook) {
|
1886
|
+
data.hook = {};
|
1887
|
+
}
|
1888
|
+
for (var i = 0; i < hooksToMerge.length; i++) {
|
1889
|
+
var key = hooksToMerge[i];
|
1890
|
+
var fromParent = data.hook[key];
|
1891
|
+
var ours = hooks[key];
|
1892
|
+
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
1993
1893
|
}
|
1994
1894
|
}
|
1995
1895
|
|
1996
|
-
function
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
handler = handler.handler;
|
1896
|
+
function mergeHook$1 (one, two) {
|
1897
|
+
return function (a, b, c, d) {
|
1898
|
+
one(a, b, c, d);
|
1899
|
+
two(a, b, c, d);
|
2001
1900
|
}
|
2002
|
-
|
2003
|
-
|
1901
|
+
}
|
1902
|
+
|
1903
|
+
/* */
|
1904
|
+
|
1905
|
+
function mergeVNodeHook (def, hookKey, hook, key) {
|
1906
|
+
key = key + hookKey;
|
1907
|
+
var injectedHash = def.__injected || (def.__injected = {});
|
1908
|
+
if (!injectedHash[key]) {
|
1909
|
+
injectedHash[key] = true;
|
1910
|
+
var oldHook = def[hookKey];
|
1911
|
+
if (oldHook) {
|
1912
|
+
def[hookKey] = function () {
|
1913
|
+
oldHook.apply(this, arguments);
|
1914
|
+
hook.apply(this, arguments);
|
1915
|
+
};
|
1916
|
+
} else {
|
1917
|
+
def[hookKey] = hook;
|
1918
|
+
}
|
2004
1919
|
}
|
2005
|
-
vm.$watch(key, handler, options);
|
2006
1920
|
}
|
2007
1921
|
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
//
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
'Avoid replacing instance root $data. ' +
|
2020
|
-
'Use nested data properties instead.',
|
2021
|
-
this
|
2022
|
-
);
|
2023
|
-
};
|
1922
|
+
/* */
|
1923
|
+
|
1924
|
+
var normalizeEvent = cached(function (name) {
|
1925
|
+
var once = name.charAt(0) === '~'; // Prefixed last, checked first
|
1926
|
+
name = once ? name.slice(1) : name;
|
1927
|
+
var capture = name.charAt(0) === '!';
|
1928
|
+
name = capture ? name.slice(1) : name;
|
1929
|
+
return {
|
1930
|
+
name: name,
|
1931
|
+
once: once,
|
1932
|
+
capture: capture
|
2024
1933
|
}
|
2025
|
-
|
1934
|
+
});
|
2026
1935
|
|
2027
|
-
|
2028
|
-
|
1936
|
+
function createEventHandle (fn) {
|
1937
|
+
var handle = {
|
1938
|
+
fn: fn,
|
1939
|
+
invoker: function () {
|
1940
|
+
var arguments$1 = arguments;
|
2029
1941
|
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
var watcher = new Watcher(vm, expOrFn, cb, options);
|
2039
|
-
if (options.immediate) {
|
2040
|
-
cb.call(vm, watcher.value);
|
2041
|
-
}
|
2042
|
-
return function unwatchFn () {
|
2043
|
-
watcher.teardown();
|
1942
|
+
var fn = handle.fn;
|
1943
|
+
if (Array.isArray(fn)) {
|
1944
|
+
for (var i = 0; i < fn.length; i++) {
|
1945
|
+
fn[i].apply(null, arguments$1);
|
1946
|
+
}
|
1947
|
+
} else {
|
1948
|
+
fn.apply(null, arguments);
|
1949
|
+
}
|
2044
1950
|
}
|
2045
1951
|
};
|
1952
|
+
return handle
|
2046
1953
|
}
|
2047
1954
|
|
2048
|
-
function
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
1955
|
+
function updateListeners (
|
1956
|
+
on,
|
1957
|
+
oldOn,
|
1958
|
+
add,
|
1959
|
+
remove$$1,
|
1960
|
+
vm
|
1961
|
+
) {
|
1962
|
+
var name, cur, old, event;
|
1963
|
+
for (name in on) {
|
1964
|
+
cur = on[name];
|
1965
|
+
old = oldOn[name];
|
1966
|
+
event = normalizeEvent(name);
|
1967
|
+
if (!cur) {
|
1968
|
+
"development" !== 'production' && warn(
|
1969
|
+
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
1970
|
+
vm
|
1971
|
+
);
|
1972
|
+
} else if (!old) {
|
1973
|
+
if (!cur.invoker) {
|
1974
|
+
cur = on[name] = createEventHandle(cur);
|
2058
1975
|
}
|
2059
|
-
|
1976
|
+
add(event.name, cur.invoker, event.once, event.capture);
|
1977
|
+
} else if (cur !== old) {
|
1978
|
+
old.fn = cur;
|
1979
|
+
on[name] = old;
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
for (name in oldOn) {
|
1983
|
+
if (!on[name]) {
|
1984
|
+
event = normalizeEvent(name);
|
1985
|
+
remove$$1(event.name, oldOn[name].invoker, event.capture);
|
1986
|
+
}
|
2060
1987
|
}
|
2061
1988
|
}
|
2062
1989
|
|
2063
1990
|
/* */
|
2064
1991
|
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
this.child = undefined;
|
2085
|
-
this.parent = undefined;
|
2086
|
-
this.raw = false;
|
2087
|
-
this.isStatic = false;
|
2088
|
-
this.isRootInsert = true;
|
2089
|
-
this.isComment = false;
|
2090
|
-
this.isCloned = false;
|
2091
|
-
this.isOnce = false;
|
2092
|
-
};
|
2093
|
-
|
2094
|
-
var createEmptyVNode = function () {
|
2095
|
-
var node = new VNode();
|
2096
|
-
node.text = '';
|
2097
|
-
node.isComment = true;
|
2098
|
-
return node
|
2099
|
-
};
|
2100
|
-
|
2101
|
-
function createTextVNode (val) {
|
2102
|
-
return new VNode(undefined, undefined, undefined, String(val))
|
1992
|
+
// The template compiler attempts to minimize the need for normalization by
|
1993
|
+
// statically analyzing the template at compile time.
|
1994
|
+
//
|
1995
|
+
// For plain HTML markup, normalization can be completely skipped because the
|
1996
|
+
// generated render function is guaranteed to return Array<VNode>. There are
|
1997
|
+
// two cases where extra normalization is needed:
|
1998
|
+
|
1999
|
+
// 1. When the children contains components - because a functional component
|
2000
|
+
// may return an Array instead of a single root. In this case, just a simple
|
2001
|
+
// nomralization is needed - if any child is an Array, we flatten the whole
|
2002
|
+
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
|
2003
|
+
// because functional components already normalize their own children.
|
2004
|
+
function simpleNormalizeChildren (children) {
|
2005
|
+
for (var i = 0; i < children.length; i++) {
|
2006
|
+
if (Array.isArray(children[i])) {
|
2007
|
+
return Array.prototype.concat.apply([], children)
|
2008
|
+
}
|
2009
|
+
}
|
2010
|
+
return children
|
2103
2011
|
}
|
2104
2012
|
|
2105
|
-
//
|
2106
|
-
//
|
2107
|
-
//
|
2108
|
-
//
|
2109
|
-
function
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
vnode.elm,
|
2116
|
-
vnode.context,
|
2117
|
-
vnode.componentOptions
|
2118
|
-
);
|
2119
|
-
cloned.ns = vnode.ns;
|
2120
|
-
cloned.isStatic = vnode.isStatic;
|
2121
|
-
cloned.key = vnode.key;
|
2122
|
-
cloned.isCloned = true;
|
2123
|
-
return cloned
|
2013
|
+
// 2. When the children contains constrcuts that always generated nested Arrays,
|
2014
|
+
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
2015
|
+
// with hand-written render functions / JSX. In such cases a full normalization
|
2016
|
+
// is needed to cater to all possible types of children values.
|
2017
|
+
function normalizeChildren (children) {
|
2018
|
+
return isPrimitive(children)
|
2019
|
+
? [createTextVNode(children)]
|
2020
|
+
: Array.isArray(children)
|
2021
|
+
? normalizeArrayChildren(children)
|
2022
|
+
: undefined
|
2124
2023
|
}
|
2125
2024
|
|
2126
|
-
function
|
2127
|
-
var res =
|
2128
|
-
|
2129
|
-
|
2025
|
+
function normalizeArrayChildren (children, nestedIndex) {
|
2026
|
+
var res = [];
|
2027
|
+
var i, c, last;
|
2028
|
+
for (i = 0; i < children.length; i++) {
|
2029
|
+
c = children[i];
|
2030
|
+
if (c == null || typeof c === 'boolean') { continue }
|
2031
|
+
last = res[res.length - 1];
|
2032
|
+
// nested
|
2033
|
+
if (Array.isArray(c)) {
|
2034
|
+
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
|
2035
|
+
} else if (isPrimitive(c)) {
|
2036
|
+
if (last && last.text) {
|
2037
|
+
last.text += String(c);
|
2038
|
+
} else if (c !== '') {
|
2039
|
+
// convert primitive to vnode
|
2040
|
+
res.push(createTextVNode(c));
|
2041
|
+
}
|
2042
|
+
} else {
|
2043
|
+
if (c.text && last && last.text) {
|
2044
|
+
res[res.length - 1] = createTextVNode(last.text + c.text);
|
2045
|
+
} else {
|
2046
|
+
// default key for nested array children (likely generated by v-for)
|
2047
|
+
if (c.tag && c.key == null && nestedIndex != null) {
|
2048
|
+
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2049
|
+
}
|
2050
|
+
res.push(c);
|
2051
|
+
}
|
2052
|
+
}
|
2130
2053
|
}
|
2131
2054
|
return res
|
2132
2055
|
}
|
2133
2056
|
|
2134
2057
|
/* */
|
2135
2058
|
|
2136
|
-
|
2059
|
+
function getFirstComponentChild (children) {
|
2060
|
+
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
|
2061
|
+
}
|
2137
2062
|
|
2138
|
-
|
2139
|
-
var options = vm.$options;
|
2063
|
+
/* */
|
2140
2064
|
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2065
|
+
var SIMPLE_NORMALIZE = 1;
|
2066
|
+
var ALWAYS_NORMALIZE = 2;
|
2067
|
+
|
2068
|
+
// wrapper function for providing a more flexible interface
|
2069
|
+
// without getting yelled at by flow
|
2070
|
+
function createElement (
|
2071
|
+
context,
|
2072
|
+
tag,
|
2073
|
+
data,
|
2074
|
+
children,
|
2075
|
+
normalizationType,
|
2076
|
+
alwaysNormalize
|
2077
|
+
) {
|
2078
|
+
if (Array.isArray(data) || isPrimitive(data)) {
|
2079
|
+
normalizationType = children;
|
2080
|
+
children = data;
|
2081
|
+
data = undefined;
|
2082
|
+
}
|
2083
|
+
if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
|
2084
|
+
return _createElement(context, tag, data, children, normalizationType)
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
function _createElement (
|
2088
|
+
context,
|
2089
|
+
tag,
|
2090
|
+
data,
|
2091
|
+
children,
|
2092
|
+
normalizationType
|
2093
|
+
) {
|
2094
|
+
if (data && data.__ob__) {
|
2095
|
+
"development" !== 'production' && warn(
|
2096
|
+
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
2097
|
+
'Always create fresh vnode data objects in each render!',
|
2098
|
+
context
|
2099
|
+
);
|
2100
|
+
return createEmptyVNode()
|
2101
|
+
}
|
2102
|
+
if (!tag) {
|
2103
|
+
// in case of component :is set to falsy value
|
2104
|
+
return createEmptyVNode()
|
2105
|
+
}
|
2106
|
+
// support single function children as default scoped slot
|
2107
|
+
if (Array.isArray(children) &&
|
2108
|
+
typeof children[0] === 'function') {
|
2109
|
+
data = data || {};
|
2110
|
+
data.scopedSlots = { default: children[0] };
|
2111
|
+
children.length = 0;
|
2112
|
+
}
|
2113
|
+
if (normalizationType === ALWAYS_NORMALIZE) {
|
2114
|
+
children = normalizeChildren(children);
|
2115
|
+
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
2116
|
+
children = simpleNormalizeChildren(children);
|
2117
|
+
}
|
2118
|
+
var vnode, ns;
|
2119
|
+
if (typeof tag === 'string') {
|
2120
|
+
var Ctor;
|
2121
|
+
ns = config.getTagNamespace(tag);
|
2122
|
+
if (config.isReservedTag(tag)) {
|
2123
|
+
// platform built-in elements
|
2124
|
+
vnode = new VNode(
|
2125
|
+
config.parsePlatformTagName(tag), data, children,
|
2126
|
+
undefined, undefined, context
|
2127
|
+
);
|
2128
|
+
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
|
2129
|
+
// component
|
2130
|
+
vnode = createComponent(Ctor, data, context, children, tag);
|
2131
|
+
} else {
|
2132
|
+
// unknown or unlisted namespaced elements
|
2133
|
+
// check at runtime because it may get assigned a namespace when its
|
2134
|
+
// parent normalizes children
|
2135
|
+
vnode = new VNode(
|
2136
|
+
tag, data, children,
|
2137
|
+
undefined, undefined, context
|
2138
|
+
);
|
2146
2139
|
}
|
2147
|
-
|
2140
|
+
} else {
|
2141
|
+
// direct component options / constructor
|
2142
|
+
vnode = createComponent(tag, data, context, children);
|
2143
|
+
}
|
2144
|
+
if (vnode) {
|
2145
|
+
if (ns) { applyNS(vnode, ns); }
|
2146
|
+
return vnode
|
2147
|
+
} else {
|
2148
|
+
return createEmptyVNode()
|
2148
2149
|
}
|
2150
|
+
}
|
2149
2151
|
|
2150
|
-
|
2151
|
-
|
2152
|
+
function applyNS (vnode, ns) {
|
2153
|
+
vnode.ns = ns;
|
2154
|
+
if (vnode.tag === 'foreignObject') {
|
2155
|
+
// use default namespace inside foreignObject
|
2156
|
+
return
|
2157
|
+
}
|
2158
|
+
if (vnode.children) {
|
2159
|
+
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
2160
|
+
var child = vnode.children[i];
|
2161
|
+
if (child.tag && !child.ns) {
|
2162
|
+
applyNS(child, ns);
|
2163
|
+
}
|
2164
|
+
}
|
2165
|
+
}
|
2166
|
+
}
|
2152
2167
|
|
2153
|
-
|
2154
|
-
vm.$refs = {};
|
2168
|
+
/* */
|
2155
2169
|
|
2156
|
-
|
2157
|
-
vm
|
2158
|
-
vm.
|
2159
|
-
vm.
|
2160
|
-
|
2170
|
+
function initRender (vm) {
|
2171
|
+
vm.$vnode = null; // the placeholder node in parent tree
|
2172
|
+
vm._vnode = null; // the root of the child tree
|
2173
|
+
vm._staticTrees = null;
|
2174
|
+
var parentVnode = vm.$options._parentVnode;
|
2175
|
+
var renderContext = parentVnode && parentVnode.context;
|
2176
|
+
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
|
2177
|
+
vm.$scopedSlots = {};
|
2178
|
+
// bind the createElement fn to this instance
|
2179
|
+
// so that we get proper render context inside it.
|
2180
|
+
// args order: tag, data, children, normalizationType, alwaysNormalize
|
2181
|
+
// internal version is used by render functions compiled from templates
|
2182
|
+
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
2183
|
+
// normalization is always applied for the public version, used in
|
2184
|
+
// user-written render functions.
|
2185
|
+
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
2161
2186
|
}
|
2162
2187
|
|
2163
|
-
function
|
2164
|
-
Vue.prototype
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2188
|
+
function renderMixin (Vue) {
|
2189
|
+
Vue.prototype.$nextTick = function (fn) {
|
2190
|
+
return nextTick(fn, this)
|
2191
|
+
};
|
2192
|
+
|
2193
|
+
Vue.prototype._render = function () {
|
2168
2194
|
var vm = this;
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
/* istanbul ignore if */
|
2174
|
-
if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
|
2175
|
-
warn(
|
2176
|
-
'You are using the runtime-only build of Vue where the template ' +
|
2177
|
-
'option is not available. Either pre-compile the templates into ' +
|
2178
|
-
'render functions, or use the compiler-included build.',
|
2179
|
-
vm
|
2180
|
-
);
|
2181
|
-
} else {
|
2182
|
-
warn(
|
2183
|
-
'Failed to mount component: template or render function not defined.',
|
2184
|
-
vm
|
2185
|
-
);
|
2186
|
-
}
|
2187
|
-
}
|
2188
|
-
}
|
2189
|
-
callHook(vm, 'beforeMount');
|
2190
|
-
vm._watcher = new Watcher(vm, function () {
|
2191
|
-
vm._update(vm._render(), hydrating);
|
2192
|
-
}, noop);
|
2193
|
-
hydrating = false;
|
2194
|
-
// manually mounted instance, call mounted on self
|
2195
|
-
// mounted is called for render-created child components in its inserted hook
|
2196
|
-
if (vm.$vnode == null) {
|
2197
|
-
vm._isMounted = true;
|
2198
|
-
callHook(vm, 'mounted');
|
2199
|
-
}
|
2200
|
-
return vm
|
2201
|
-
};
|
2195
|
+
var ref = vm.$options;
|
2196
|
+
var render = ref.render;
|
2197
|
+
var staticRenderFns = ref.staticRenderFns;
|
2198
|
+
var _parentVnode = ref._parentVnode;
|
2202
2199
|
|
2203
|
-
Vue.prototype._update = function (vnode, hydrating) {
|
2204
|
-
var vm = this;
|
2205
2200
|
if (vm._isMounted) {
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
var prevActiveInstance = activeInstance;
|
2211
|
-
activeInstance = vm;
|
2212
|
-
vm._vnode = vnode;
|
2213
|
-
// Vue.prototype.__patch__ is injected in entry points
|
2214
|
-
// based on the rendering backend used.
|
2215
|
-
if (!prevVnode) {
|
2216
|
-
// initial render
|
2217
|
-
vm.$el = vm.__patch__(
|
2218
|
-
vm.$el, vnode, hydrating, false /* removeOnly */,
|
2219
|
-
vm.$options._parentElm,
|
2220
|
-
vm.$options._refElm
|
2221
|
-
);
|
2222
|
-
} else {
|
2223
|
-
// updates
|
2224
|
-
vm.$el = vm.__patch__(prevVnode, vnode);
|
2225
|
-
}
|
2226
|
-
activeInstance = prevActiveInstance;
|
2227
|
-
// update __vue__ reference
|
2228
|
-
if (prevEl) {
|
2229
|
-
prevEl.__vue__ = null;
|
2230
|
-
}
|
2231
|
-
if (vm.$el) {
|
2232
|
-
vm.$el.__vue__ = vm;
|
2233
|
-
}
|
2234
|
-
// if parent is an HOC, update its $el as well
|
2235
|
-
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
2236
|
-
vm.$parent.$el = vm.$el;
|
2201
|
+
// clone slot nodes on re-renders
|
2202
|
+
for (var key in vm.$slots) {
|
2203
|
+
vm.$slots[key] = cloneVNodes(vm.$slots[key]);
|
2204
|
+
}
|
2237
2205
|
}
|
2238
|
-
|
2239
|
-
|
2206
|
+
|
2207
|
+
if (_parentVnode && _parentVnode.data.scopedSlots) {
|
2208
|
+
vm.$scopedSlots = _parentVnode.data.scopedSlots;
|
2240
2209
|
}
|
2241
|
-
};
|
2242
2210
|
|
2243
|
-
|
2244
|
-
|
2245
|
-
listeners,
|
2246
|
-
parentVnode,
|
2247
|
-
renderChildren
|
2248
|
-
) {
|
2249
|
-
var vm = this;
|
2250
|
-
var hasChildren = !!(vm.$options._renderChildren || renderChildren);
|
2251
|
-
vm.$options._parentVnode = parentVnode;
|
2252
|
-
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
2253
|
-
if (vm._vnode) { // update child tree's parent
|
2254
|
-
vm._vnode.parent = parentVnode;
|
2211
|
+
if (staticRenderFns && !vm._staticTrees) {
|
2212
|
+
vm._staticTrees = [];
|
2255
2213
|
}
|
2256
|
-
|
2257
|
-
//
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
}
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2214
|
+
// set parent vnode. this allows render functions to have access
|
2215
|
+
// to the data on the placeholder node.
|
2216
|
+
vm.$vnode = _parentVnode;
|
2217
|
+
// render self
|
2218
|
+
var vnode;
|
2219
|
+
try {
|
2220
|
+
vnode = render.call(vm._renderProxy, vm.$createElement);
|
2221
|
+
} catch (e) {
|
2222
|
+
/* istanbul ignore else */
|
2223
|
+
if (config.errorHandler) {
|
2224
|
+
config.errorHandler.call(null, e, vm);
|
2225
|
+
} else {
|
2226
|
+
{
|
2227
|
+
warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
|
2228
|
+
}
|
2229
|
+
throw e
|
2271
2230
|
}
|
2272
|
-
|
2273
|
-
|
2274
|
-
// update listeners
|
2275
|
-
if (listeners) {
|
2276
|
-
var oldListeners = vm.$options._parentListeners;
|
2277
|
-
vm.$options._parentListeners = listeners;
|
2278
|
-
vm._updateListeners(listeners, oldListeners);
|
2231
|
+
// return previous vnode to prevent render error causing blank component
|
2232
|
+
vnode = vm._vnode;
|
2279
2233
|
}
|
2280
|
-
//
|
2281
|
-
if (
|
2282
|
-
|
2283
|
-
|
2234
|
+
// return empty vnode in case the render function errored out
|
2235
|
+
if (!(vnode instanceof VNode)) {
|
2236
|
+
if ("development" !== 'production' && Array.isArray(vnode)) {
|
2237
|
+
warn(
|
2238
|
+
'Multiple root nodes returned from render function. Render function ' +
|
2239
|
+
'should return a single root node.',
|
2240
|
+
vm
|
2241
|
+
);
|
2242
|
+
}
|
2243
|
+
vnode = createEmptyVNode();
|
2284
2244
|
}
|
2245
|
+
// set parent
|
2246
|
+
vnode.parent = _parentVnode;
|
2247
|
+
return vnode
|
2285
2248
|
};
|
2286
2249
|
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2250
|
+
// toString for mustaches
|
2251
|
+
Vue.prototype._s = _toString;
|
2252
|
+
// convert text to vnode
|
2253
|
+
Vue.prototype._v = createTextVNode;
|
2254
|
+
// number conversion
|
2255
|
+
Vue.prototype._n = toNumber;
|
2256
|
+
// empty vnode
|
2257
|
+
Vue.prototype._e = createEmptyVNode;
|
2258
|
+
// loose equal
|
2259
|
+
Vue.prototype._q = looseEqual;
|
2260
|
+
// loose indexOf
|
2261
|
+
Vue.prototype._i = looseIndexOf;
|
2262
|
+
|
2263
|
+
// render static tree by index
|
2264
|
+
Vue.prototype._m = function renderStatic (
|
2265
|
+
index,
|
2266
|
+
isInFor
|
2267
|
+
) {
|
2268
|
+
var tree = this._staticTrees[index];
|
2269
|
+
// if has already-rendered static tree and not inside v-for,
|
2270
|
+
// we can reuse the same tree by doing a shallow clone.
|
2271
|
+
if (tree && !isInFor) {
|
2272
|
+
return Array.isArray(tree)
|
2273
|
+
? cloneVNodes(tree)
|
2274
|
+
: cloneVNode(tree)
|
2291
2275
|
}
|
2276
|
+
// otherwise, render a fresh tree.
|
2277
|
+
tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
|
2278
|
+
markStatic(tree, ("__static__" + index), false);
|
2279
|
+
return tree
|
2292
2280
|
};
|
2293
2281
|
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
var parent = vm.$parent;
|
2303
|
-
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
2304
|
-
remove$1(parent.$children, vm);
|
2305
|
-
}
|
2306
|
-
// teardown watchers
|
2307
|
-
if (vm._watcher) {
|
2308
|
-
vm._watcher.teardown();
|
2309
|
-
}
|
2310
|
-
var i = vm._watchers.length;
|
2311
|
-
while (i--) {
|
2312
|
-
vm._watchers[i].teardown();
|
2313
|
-
}
|
2314
|
-
// remove reference from data ob
|
2315
|
-
// frozen object may not have observer.
|
2316
|
-
if (vm._data.__ob__) {
|
2317
|
-
vm._data.__ob__.vmCount--;
|
2318
|
-
}
|
2319
|
-
// call the last hook...
|
2320
|
-
vm._isDestroyed = true;
|
2321
|
-
callHook(vm, 'destroyed');
|
2322
|
-
// turn off all instance listeners.
|
2323
|
-
vm.$off();
|
2324
|
-
// remove __vue__ reference
|
2325
|
-
if (vm.$el) {
|
2326
|
-
vm.$el.__vue__ = null;
|
2327
|
-
}
|
2328
|
-
// invoke destroy hooks on current rendered tree
|
2329
|
-
vm.__patch__(vm._vnode, null);
|
2282
|
+
// mark node as static (v-once)
|
2283
|
+
Vue.prototype._o = function markOnce (
|
2284
|
+
tree,
|
2285
|
+
index,
|
2286
|
+
key
|
2287
|
+
) {
|
2288
|
+
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
2289
|
+
return tree
|
2330
2290
|
};
|
2331
|
-
}
|
2332
2291
|
|
2333
|
-
function
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2292
|
+
function markStatic (tree, key, isOnce) {
|
2293
|
+
if (Array.isArray(tree)) {
|
2294
|
+
for (var i = 0; i < tree.length; i++) {
|
2295
|
+
if (tree[i] && typeof tree[i] !== 'string') {
|
2296
|
+
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
2297
|
+
}
|
2298
|
+
}
|
2299
|
+
} else {
|
2300
|
+
markStaticNode(tree, key, isOnce);
|
2338
2301
|
}
|
2339
2302
|
}
|
2340
|
-
vm.$emit('hook:' + hook);
|
2341
|
-
}
|
2342
|
-
|
2343
|
-
/* */
|
2344
|
-
|
2345
|
-
var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 };
|
2346
|
-
var hooksToMerge = Object.keys(hooks);
|
2347
|
-
|
2348
|
-
function createComponent (
|
2349
|
-
Ctor,
|
2350
|
-
data,
|
2351
|
-
context,
|
2352
|
-
children,
|
2353
|
-
tag
|
2354
|
-
) {
|
2355
|
-
if (!Ctor) {
|
2356
|
-
return
|
2357
|
-
}
|
2358
2303
|
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2304
|
+
function markStaticNode (node, key, isOnce) {
|
2305
|
+
node.isStatic = true;
|
2306
|
+
node.key = key;
|
2307
|
+
node.isOnce = isOnce;
|
2362
2308
|
}
|
2363
2309
|
|
2364
|
-
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
return
|
2369
|
-
}
|
2310
|
+
// filter resolution helper
|
2311
|
+
Vue.prototype._f = function resolveFilter (id) {
|
2312
|
+
return resolveAsset(this.$options, 'filters', id, true) || identity
|
2313
|
+
};
|
2370
2314
|
|
2371
|
-
//
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2379
|
-
|
2380
|
-
|
2381
|
-
|
2382
|
-
|
2383
|
-
|
2384
|
-
|
2315
|
+
// render v-for
|
2316
|
+
Vue.prototype._l = function renderList (
|
2317
|
+
val,
|
2318
|
+
render
|
2319
|
+
) {
|
2320
|
+
var ret, i, l, keys, key;
|
2321
|
+
if (Array.isArray(val) || typeof val === 'string') {
|
2322
|
+
ret = new Array(val.length);
|
2323
|
+
for (i = 0, l = val.length; i < l; i++) {
|
2324
|
+
ret[i] = render(val[i], i);
|
2325
|
+
}
|
2326
|
+
} else if (typeof val === 'number') {
|
2327
|
+
ret = new Array(val);
|
2328
|
+
for (i = 0; i < val; i++) {
|
2329
|
+
ret[i] = render(i + 1, i);
|
2330
|
+
}
|
2331
|
+
} else if (isObject(val)) {
|
2332
|
+
keys = Object.keys(val);
|
2333
|
+
ret = new Array(keys.length);
|
2334
|
+
for (i = 0, l = keys.length; i < l; i++) {
|
2335
|
+
key = keys[i];
|
2336
|
+
ret[i] = render(val[key], key, i);
|
2385
2337
|
}
|
2386
2338
|
}
|
2387
|
-
|
2388
|
-
|
2389
|
-
// resolve constructor options in case global mixins are applied after
|
2390
|
-
// component constructor creation
|
2391
|
-
resolveConstructorOptions(Ctor);
|
2392
|
-
|
2393
|
-
data = data || {};
|
2394
|
-
|
2395
|
-
// extract props
|
2396
|
-
var propsData = extractProps(data, Ctor);
|
2397
|
-
|
2398
|
-
// functional component
|
2399
|
-
if (Ctor.options.functional) {
|
2400
|
-
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
2401
|
-
}
|
2402
|
-
|
2403
|
-
// extract listeners, since these needs to be treated as
|
2404
|
-
// child component listeners instead of DOM listeners
|
2405
|
-
var listeners = data.on;
|
2406
|
-
// replace with listeners with .native modifier
|
2407
|
-
data.on = data.nativeOn;
|
2339
|
+
return ret
|
2340
|
+
};
|
2408
2341
|
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2342
|
+
// renderSlot
|
2343
|
+
Vue.prototype._t = function (
|
2344
|
+
name,
|
2345
|
+
fallback,
|
2346
|
+
props,
|
2347
|
+
bindObject
|
2348
|
+
) {
|
2349
|
+
var scopedSlotFn = this.$scopedSlots[name];
|
2350
|
+
if (scopedSlotFn) { // scoped slot
|
2351
|
+
props = props || {};
|
2352
|
+
if (bindObject) {
|
2353
|
+
extend(props, bindObject);
|
2354
|
+
}
|
2355
|
+
return scopedSlotFn(props) || fallback
|
2356
|
+
} else {
|
2357
|
+
var slotNodes = this.$slots[name];
|
2358
|
+
// warn duplicate slot usage
|
2359
|
+
if (slotNodes && "development" !== 'production') {
|
2360
|
+
slotNodes._rendered && warn(
|
2361
|
+
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
|
2362
|
+
"- this will likely cause render errors.",
|
2363
|
+
this
|
2364
|
+
);
|
2365
|
+
slotNodes._rendered = true;
|
2366
|
+
}
|
2367
|
+
return slotNodes || fallback
|
2368
|
+
}
|
2369
|
+
};
|
2414
2370
|
|
2415
|
-
//
|
2416
|
-
|
2371
|
+
// apply v-bind object
|
2372
|
+
Vue.prototype._b = function bindProps (
|
2373
|
+
data,
|
2374
|
+
tag,
|
2375
|
+
value,
|
2376
|
+
asProp
|
2377
|
+
) {
|
2378
|
+
if (value) {
|
2379
|
+
if (!isObject(value)) {
|
2380
|
+
"development" !== 'production' && warn(
|
2381
|
+
'v-bind without argument expects an Object or Array value',
|
2382
|
+
this
|
2383
|
+
);
|
2384
|
+
} else {
|
2385
|
+
if (Array.isArray(value)) {
|
2386
|
+
value = toObject(value);
|
2387
|
+
}
|
2388
|
+
for (var key in value) {
|
2389
|
+
if (key === 'class' || key === 'style') {
|
2390
|
+
data[key] = value[key];
|
2391
|
+
} else {
|
2392
|
+
var type = data.attrs && data.attrs.type;
|
2393
|
+
var hash = asProp || config.mustUseProp(tag, type, key)
|
2394
|
+
? data.domProps || (data.domProps = {})
|
2395
|
+
: data.attrs || (data.attrs = {});
|
2396
|
+
hash[key] = value[key];
|
2397
|
+
}
|
2398
|
+
}
|
2399
|
+
}
|
2400
|
+
}
|
2401
|
+
return data
|
2402
|
+
};
|
2417
2403
|
|
2418
|
-
//
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2404
|
+
// check v-on keyCodes
|
2405
|
+
Vue.prototype._k = function checkKeyCodes (
|
2406
|
+
eventKeyCode,
|
2407
|
+
key,
|
2408
|
+
builtInAlias
|
2409
|
+
) {
|
2410
|
+
var keyCodes = config.keyCodes[key] || builtInAlias;
|
2411
|
+
if (Array.isArray(keyCodes)) {
|
2412
|
+
return keyCodes.indexOf(eventKeyCode) === -1
|
2413
|
+
} else {
|
2414
|
+
return keyCodes !== eventKeyCode
|
2415
|
+
}
|
2416
|
+
};
|
2426
2417
|
}
|
2427
2418
|
|
2428
|
-
function
|
2429
|
-
|
2430
|
-
|
2431
|
-
data,
|
2432
|
-
context,
|
2433
|
-
children
|
2419
|
+
function resolveSlots (
|
2420
|
+
children,
|
2421
|
+
context
|
2434
2422
|
) {
|
2435
|
-
var
|
2436
|
-
|
2437
|
-
|
2438
|
-
for (var key in propOptions) {
|
2439
|
-
props[key] = validateProp(key, propOptions, propsData);
|
2440
|
-
}
|
2423
|
+
var slots = {};
|
2424
|
+
if (!children) {
|
2425
|
+
return slots
|
2441
2426
|
}
|
2442
|
-
|
2443
|
-
|
2444
|
-
var
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
|
2427
|
+
var defaultSlot = [];
|
2428
|
+
var name, child;
|
2429
|
+
for (var i = 0, l = children.length; i < l; i++) {
|
2430
|
+
child = children[i];
|
2431
|
+
// named slots should only be respected if the vnode was rendered in the
|
2432
|
+
// same context.
|
2433
|
+
if ((child.context === context || child.functionalContext === context) &&
|
2434
|
+
child.data && (name = child.data.slot)) {
|
2435
|
+
var slot = (slots[name] || (slots[name] = []));
|
2436
|
+
if (child.tag === 'template') {
|
2437
|
+
slot.push.apply(slot, child.children);
|
2438
|
+
} else {
|
2439
|
+
slot.push(child);
|
2440
|
+
}
|
2441
|
+
} else {
|
2442
|
+
defaultSlot.push(child);
|
2457
2443
|
}
|
2458
2444
|
}
|
2459
|
-
|
2445
|
+
// ignore single whitespace
|
2446
|
+
if (defaultSlot.length && !(
|
2447
|
+
defaultSlot.length === 1 &&
|
2448
|
+
(defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
|
2449
|
+
)) {
|
2450
|
+
slots.default = defaultSlot;
|
2451
|
+
}
|
2452
|
+
return slots
|
2460
2453
|
}
|
2461
2454
|
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
var
|
2469
|
-
|
2470
|
-
|
2471
|
-
parent: parent,
|
2472
|
-
propsData: vnodeComponentOptions.propsData,
|
2473
|
-
_componentTag: vnodeComponentOptions.tag,
|
2474
|
-
_parentVnode: vnode,
|
2475
|
-
_parentListeners: vnodeComponentOptions.listeners,
|
2476
|
-
_renderChildren: vnodeComponentOptions.children,
|
2477
|
-
_parentElm: parentElm || null,
|
2478
|
-
_refElm: refElm || null
|
2479
|
-
};
|
2480
|
-
// check inline-template render functions
|
2481
|
-
var inlineTemplate = vnode.data.inlineTemplate;
|
2482
|
-
if (inlineTemplate) {
|
2483
|
-
options.render = inlineTemplate.render;
|
2484
|
-
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
2455
|
+
/* */
|
2456
|
+
|
2457
|
+
function initEvents (vm) {
|
2458
|
+
vm._events = Object.create(null);
|
2459
|
+
vm._hasHookEvent = false;
|
2460
|
+
// init parent attached events
|
2461
|
+
var listeners = vm.$options._parentListeners;
|
2462
|
+
if (listeners) {
|
2463
|
+
updateComponentListeners(vm, listeners);
|
2485
2464
|
}
|
2486
|
-
return new vnodeComponentOptions.Ctor(options)
|
2487
2465
|
}
|
2488
2466
|
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
var child = vnode.child = createComponentInstanceForVnode(
|
2497
|
-
vnode,
|
2498
|
-
activeInstance,
|
2499
|
-
parentElm,
|
2500
|
-
refElm
|
2501
|
-
);
|
2502
|
-
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
2503
|
-
} else if (vnode.data.keepAlive) {
|
2504
|
-
// kept-alive components, treat as a patch
|
2505
|
-
var mountedNode = vnode; // work around flow
|
2506
|
-
prepatch(mountedNode, mountedNode);
|
2467
|
+
var target;
|
2468
|
+
|
2469
|
+
function add$1 (event, fn, once) {
|
2470
|
+
if (once) {
|
2471
|
+
target.$once(event, fn);
|
2472
|
+
} else {
|
2473
|
+
target.$on(event, fn);
|
2507
2474
|
}
|
2508
2475
|
}
|
2509
2476
|
|
2510
|
-
function
|
2511
|
-
|
2512
|
-
|
2477
|
+
function remove$2 (event, fn) {
|
2478
|
+
target.$off(event, fn);
|
2479
|
+
}
|
2480
|
+
|
2481
|
+
function updateComponentListeners (
|
2482
|
+
vm,
|
2483
|
+
listeners,
|
2484
|
+
oldListeners
|
2513
2485
|
) {
|
2514
|
-
|
2515
|
-
|
2516
|
-
child._updateFromParent(
|
2517
|
-
options.propsData, // updated props
|
2518
|
-
options.listeners, // updated listeners
|
2519
|
-
vnode, // new parent vnode
|
2520
|
-
options.children // new children
|
2521
|
-
);
|
2486
|
+
target = vm;
|
2487
|
+
updateListeners(listeners, oldListeners || {}, add$1, remove$2, vm);
|
2522
2488
|
}
|
2523
2489
|
|
2524
|
-
function
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
}
|
2533
|
-
}
|
2534
|
-
|
2535
|
-
function destroy$1 (vnode) {
|
2536
|
-
if (!vnode.child._isDestroyed) {
|
2537
|
-
if (!vnode.data.keepAlive) {
|
2538
|
-
vnode.child.$destroy();
|
2539
|
-
} else {
|
2540
|
-
vnode.child._inactive = true;
|
2541
|
-
callHook(vnode.child, 'deactivated');
|
2490
|
+
function eventsMixin (Vue) {
|
2491
|
+
var hookRE = /^hook:/;
|
2492
|
+
Vue.prototype.$on = function (event, fn) {
|
2493
|
+
var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
|
2494
|
+
// optimize hook:event cost by using a boolean flag marked at registration
|
2495
|
+
// instead of a hash lookup
|
2496
|
+
if (hookRE.test(event)) {
|
2497
|
+
vm._hasHookEvent = true;
|
2542
2498
|
}
|
2543
|
-
|
2544
|
-
}
|
2545
|
-
|
2546
|
-
function resolveAsyncComponent (
|
2547
|
-
factory,
|
2548
|
-
baseCtor,
|
2549
|
-
cb
|
2550
|
-
) {
|
2551
|
-
if (factory.requested) {
|
2552
|
-
// pool callbacks
|
2553
|
-
factory.pendingCallbacks.push(cb);
|
2554
|
-
} else {
|
2555
|
-
factory.requested = true;
|
2556
|
-
var cbs = factory.pendingCallbacks = [cb];
|
2557
|
-
var sync = true;
|
2558
|
-
|
2559
|
-
var resolve = function (res) {
|
2560
|
-
if (isObject(res)) {
|
2561
|
-
res = baseCtor.extend(res);
|
2562
|
-
}
|
2563
|
-
// cache resolved
|
2564
|
-
factory.resolved = res;
|
2565
|
-
// 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);
|
2499
|
+
return vm
|
2500
|
+
};
|
2582
2501
|
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2502
|
+
Vue.prototype.$once = function (event, fn) {
|
2503
|
+
var vm = this;
|
2504
|
+
function on () {
|
2505
|
+
vm.$off(event, on);
|
2506
|
+
fn.apply(vm, arguments);
|
2586
2507
|
}
|
2508
|
+
on.fn = fn;
|
2509
|
+
vm.$on(event, on);
|
2510
|
+
return vm
|
2511
|
+
};
|
2587
2512
|
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
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);
|
2513
|
+
Vue.prototype.$off = function (event, fn) {
|
2514
|
+
var vm = this;
|
2515
|
+
// all
|
2516
|
+
if (!arguments.length) {
|
2517
|
+
vm._events = Object.create(null);
|
2518
|
+
return vm
|
2612
2519
|
}
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
if (
|
2628
|
-
|
2629
|
-
|
2630
|
-
return true
|
2631
|
-
} else if (hasOwn(hash, altKey)) {
|
2632
|
-
res[key] = hash[altKey];
|
2633
|
-
if (!preserve) {
|
2634
|
-
delete hash[altKey];
|
2520
|
+
// specific event
|
2521
|
+
var cbs = vm._events[event];
|
2522
|
+
if (!cbs) {
|
2523
|
+
return vm
|
2524
|
+
}
|
2525
|
+
if (arguments.length === 1) {
|
2526
|
+
vm._events[event] = null;
|
2527
|
+
return vm
|
2528
|
+
}
|
2529
|
+
// specific handler
|
2530
|
+
var cb;
|
2531
|
+
var i = cbs.length;
|
2532
|
+
while (i--) {
|
2533
|
+
cb = cbs[i];
|
2534
|
+
if (cb === fn || cb.fn === fn) {
|
2535
|
+
cbs.splice(i, 1);
|
2536
|
+
break
|
2635
2537
|
}
|
2636
|
-
return true
|
2637
2538
|
}
|
2638
|
-
|
2639
|
-
|
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
|
-
/* */
|
2539
|
+
return vm
|
2540
|
+
};
|
2662
2541
|
|
2663
|
-
function
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
hook.apply(this, arguments);
|
2673
|
-
};
|
2674
|
-
} else {
|
2675
|
-
def[hookKey] = hook;
|
2542
|
+
Vue.prototype.$emit = function (event) {
|
2543
|
+
var vm = this;
|
2544
|
+
var cbs = vm._events[event];
|
2545
|
+
if (cbs) {
|
2546
|
+
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
2547
|
+
var args = toArray(arguments, 1);
|
2548
|
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
2549
|
+
cbs[i].apply(vm, args);
|
2550
|
+
}
|
2676
2551
|
}
|
2677
|
-
|
2552
|
+
return vm
|
2553
|
+
};
|
2678
2554
|
}
|
2679
2555
|
|
2680
2556
|
/* */
|
2681
2557
|
|
2682
|
-
|
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
|
-
}
|
2558
|
+
var activeInstance = null;
|
2735
2559
|
|
2736
|
-
function
|
2737
|
-
|
2738
|
-
var arguments$1 = arguments;
|
2560
|
+
function initLifecycle (vm) {
|
2561
|
+
var options = vm.$options;
|
2739
2562
|
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2563
|
+
// locate first non-abstract parent
|
2564
|
+
var parent = options.parent;
|
2565
|
+
if (parent && !options.abstract) {
|
2566
|
+
while (parent.$options.abstract && parent.$parent) {
|
2567
|
+
parent = parent.$parent;
|
2743
2568
|
}
|
2569
|
+
parent.$children.push(vm);
|
2744
2570
|
}
|
2745
|
-
}
|
2746
2571
|
|
2747
|
-
|
2748
|
-
|
2749
|
-
var single = arguments.length === 1;
|
2750
|
-
single ? o.fn(ev) : o.fn.apply(null, arguments);
|
2751
|
-
}
|
2752
|
-
}
|
2572
|
+
vm.$parent = parent;
|
2573
|
+
vm.$root = parent ? parent.$root : vm;
|
2753
2574
|
|
2754
|
-
|
2575
|
+
vm.$children = [];
|
2576
|
+
vm.$refs = {};
|
2755
2577
|
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
: undefined
|
2578
|
+
vm._watcher = null;
|
2579
|
+
vm._inactive = false;
|
2580
|
+
vm._isMounted = false;
|
2581
|
+
vm._isDestroyed = false;
|
2582
|
+
vm._isBeingDestroyed = false;
|
2762
2583
|
}
|
2763
2584
|
|
2764
|
-
function
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2585
|
+
function lifecycleMixin (Vue) {
|
2586
|
+
Vue.prototype._mount = function (
|
2587
|
+
el,
|
2588
|
+
hydrating
|
2589
|
+
) {
|
2590
|
+
var vm = this;
|
2591
|
+
vm.$el = el;
|
2592
|
+
if (!vm.$options.render) {
|
2593
|
+
vm.$options.render = createEmptyVNode;
|
2594
|
+
{
|
2595
|
+
/* istanbul ignore if */
|
2596
|
+
if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
|
2597
|
+
warn(
|
2598
|
+
'You are using the runtime-only build of Vue where the template ' +
|
2599
|
+
'option is not available. Either pre-compile the templates into ' +
|
2600
|
+
'render functions, or use the compiler-included build.',
|
2601
|
+
vm
|
2602
|
+
);
|
2603
|
+
} else {
|
2604
|
+
warn(
|
2605
|
+
'Failed to mount component: template or render function not defined.',
|
2606
|
+
vm
|
2607
|
+
);
|
2608
|
+
}
|
2780
2609
|
}
|
2610
|
+
}
|
2611
|
+
callHook(vm, 'beforeMount');
|
2612
|
+
vm._watcher = new Watcher(vm, function updateComponent () {
|
2613
|
+
vm._update(vm._render(), hydrating);
|
2614
|
+
}, noop);
|
2615
|
+
hydrating = false;
|
2616
|
+
// manually mounted instance, call mounted on self
|
2617
|
+
// mounted is called for render-created child components in its inserted hook
|
2618
|
+
if (vm.$vnode == null) {
|
2619
|
+
vm._isMounted = true;
|
2620
|
+
callHook(vm, 'mounted');
|
2621
|
+
}
|
2622
|
+
return vm
|
2623
|
+
};
|
2624
|
+
|
2625
|
+
Vue.prototype._update = function (vnode, hydrating) {
|
2626
|
+
var vm = this;
|
2627
|
+
if (vm._isMounted) {
|
2628
|
+
callHook(vm, 'beforeUpdate');
|
2629
|
+
}
|
2630
|
+
var prevEl = vm.$el;
|
2631
|
+
var prevVnode = vm._vnode;
|
2632
|
+
var prevActiveInstance = activeInstance;
|
2633
|
+
activeInstance = vm;
|
2634
|
+
vm._vnode = vnode;
|
2635
|
+
// Vue.prototype.__patch__ is injected in entry points
|
2636
|
+
// based on the rendering backend used.
|
2637
|
+
if (!prevVnode) {
|
2638
|
+
// initial render
|
2639
|
+
vm.$el = vm.__patch__(
|
2640
|
+
vm.$el, vnode, hydrating, false /* removeOnly */,
|
2641
|
+
vm.$options._parentElm,
|
2642
|
+
vm.$options._refElm
|
2643
|
+
);
|
2781
2644
|
} else {
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2645
|
+
// updates
|
2646
|
+
vm.$el = vm.__patch__(prevVnode, vnode);
|
2647
|
+
}
|
2648
|
+
activeInstance = prevActiveInstance;
|
2649
|
+
// update __vue__ reference
|
2650
|
+
if (prevEl) {
|
2651
|
+
prevEl.__vue__ = null;
|
2652
|
+
}
|
2653
|
+
if (vm.$el) {
|
2654
|
+
vm.$el.__vue__ = vm;
|
2655
|
+
}
|
2656
|
+
// if parent is an HOC, update its $el as well
|
2657
|
+
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
2658
|
+
vm.$parent.$el = vm.$el;
|
2659
|
+
}
|
2660
|
+
// updated hook is called by the scheduler to ensure that children are
|
2661
|
+
// updated in a parent's updated hook.
|
2662
|
+
};
|
2663
|
+
|
2664
|
+
Vue.prototype._updateFromParent = function (
|
2665
|
+
propsData,
|
2666
|
+
listeners,
|
2667
|
+
parentVnode,
|
2668
|
+
renderChildren
|
2669
|
+
) {
|
2670
|
+
var vm = this;
|
2671
|
+
var hasChildren = !!(vm.$options._renderChildren || renderChildren);
|
2672
|
+
vm.$options._parentVnode = parentVnode;
|
2673
|
+
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
2674
|
+
if (vm._vnode) { // update child tree's parent
|
2675
|
+
vm._vnode.parent = parentVnode;
|
2676
|
+
}
|
2677
|
+
vm.$options._renderChildren = renderChildren;
|
2678
|
+
// update props
|
2679
|
+
if (propsData && vm.$options.props) {
|
2680
|
+
observerState.shouldConvert = false;
|
2681
|
+
{
|
2682
|
+
observerState.isSettingProps = true;
|
2790
2683
|
}
|
2684
|
+
var propKeys = vm.$options._propKeys || [];
|
2685
|
+
for (var i = 0; i < propKeys.length; i++) {
|
2686
|
+
var key = propKeys[i];
|
2687
|
+
vm[key] = validateProp(key, vm.$options.props, propsData, vm);
|
2688
|
+
}
|
2689
|
+
observerState.shouldConvert = true;
|
2690
|
+
{
|
2691
|
+
observerState.isSettingProps = false;
|
2692
|
+
}
|
2693
|
+
vm.$options.propsData = propsData;
|
2694
|
+
}
|
2695
|
+
// update listeners
|
2696
|
+
if (listeners) {
|
2697
|
+
var oldListeners = vm.$options._parentListeners;
|
2698
|
+
vm.$options._parentListeners = listeners;
|
2699
|
+
updateComponentListeners(vm, listeners, oldListeners);
|
2700
|
+
}
|
2701
|
+
// resolve slots + force update if has children
|
2702
|
+
if (hasChildren) {
|
2703
|
+
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
2704
|
+
vm.$forceUpdate();
|
2705
|
+
}
|
2706
|
+
};
|
2707
|
+
|
2708
|
+
Vue.prototype.$forceUpdate = function () {
|
2709
|
+
var vm = this;
|
2710
|
+
if (vm._watcher) {
|
2711
|
+
vm._watcher.update();
|
2712
|
+
}
|
2713
|
+
};
|
2714
|
+
|
2715
|
+
Vue.prototype.$destroy = function () {
|
2716
|
+
var vm = this;
|
2717
|
+
if (vm._isBeingDestroyed) {
|
2718
|
+
return
|
2719
|
+
}
|
2720
|
+
callHook(vm, 'beforeDestroy');
|
2721
|
+
vm._isBeingDestroyed = true;
|
2722
|
+
// remove self from parent
|
2723
|
+
var parent = vm.$parent;
|
2724
|
+
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
2725
|
+
remove$1(parent.$children, vm);
|
2726
|
+
}
|
2727
|
+
// teardown watchers
|
2728
|
+
if (vm._watcher) {
|
2729
|
+
vm._watcher.teardown();
|
2730
|
+
}
|
2731
|
+
var i = vm._watchers.length;
|
2732
|
+
while (i--) {
|
2733
|
+
vm._watchers[i].teardown();
|
2734
|
+
}
|
2735
|
+
// remove reference from data ob
|
2736
|
+
// frozen object may not have observer.
|
2737
|
+
if (vm._data.__ob__) {
|
2738
|
+
vm._data.__ob__.vmCount--;
|
2739
|
+
}
|
2740
|
+
// call the last hook...
|
2741
|
+
vm._isDestroyed = true;
|
2742
|
+
callHook(vm, 'destroyed');
|
2743
|
+
// turn off all instance listeners.
|
2744
|
+
vm.$off();
|
2745
|
+
// remove __vue__ reference
|
2746
|
+
if (vm.$el) {
|
2747
|
+
vm.$el.__vue__ = null;
|
2748
|
+
}
|
2749
|
+
// invoke destroy hooks on current rendered tree
|
2750
|
+
vm.__patch__(vm._vnode, null);
|
2751
|
+
};
|
2752
|
+
}
|
2753
|
+
|
2754
|
+
function callHook (vm, hook) {
|
2755
|
+
var handlers = vm.$options[hook];
|
2756
|
+
if (handlers) {
|
2757
|
+
for (var i = 0, j = handlers.length; i < j; i++) {
|
2758
|
+
handlers[i].call(vm);
|
2791
2759
|
}
|
2792
2760
|
}
|
2793
|
-
|
2761
|
+
if (vm._hasHookEvent) {
|
2762
|
+
vm.$emit('hook:' + hook);
|
2763
|
+
}
|
2794
2764
|
}
|
2795
2765
|
|
2796
2766
|
/* */
|
2797
2767
|
|
2798
|
-
function getFirstComponentChild (children) {
|
2799
|
-
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
|
2800
|
-
}
|
2801
2768
|
|
2802
|
-
|
2769
|
+
var queue = [];
|
2770
|
+
var has$1 = {};
|
2771
|
+
var circular = {};
|
2772
|
+
var waiting = false;
|
2773
|
+
var flushing = false;
|
2774
|
+
var index = 0;
|
2803
2775
|
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
alwaysNormalize
|
2813
|
-
) {
|
2814
|
-
if (Array.isArray(data) || isPrimitive(data)) {
|
2815
|
-
needNormalization = children;
|
2816
|
-
children = data;
|
2817
|
-
data = undefined;
|
2776
|
+
/**
|
2777
|
+
* Reset the scheduler's state.
|
2778
|
+
*/
|
2779
|
+
function resetSchedulerState () {
|
2780
|
+
queue.length = 0;
|
2781
|
+
has$1 = {};
|
2782
|
+
{
|
2783
|
+
circular = {};
|
2818
2784
|
}
|
2819
|
-
|
2820
|
-
return _createElement(context, tag, data, children, needNormalization)
|
2785
|
+
waiting = flushing = false;
|
2821
2786
|
}
|
2822
2787
|
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
)
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2788
|
+
/**
|
2789
|
+
* Flush both queues and run the watchers.
|
2790
|
+
*/
|
2791
|
+
function flushSchedulerQueue () {
|
2792
|
+
flushing = true;
|
2793
|
+
var watcher, id, vm;
|
2794
|
+
|
2795
|
+
// Sort queue before flush.
|
2796
|
+
// This ensures that:
|
2797
|
+
// 1. Components are updated from parent to child. (because parent is always
|
2798
|
+
// created before the child)
|
2799
|
+
// 2. A component's user watchers are run before its render watcher (because
|
2800
|
+
// user watchers are created before the render watcher)
|
2801
|
+
// 3. If a component is destroyed during a parent component's watcher run,
|
2802
|
+
// its watchers can be skipped.
|
2803
|
+
queue.sort(function (a, b) { return a.id - b.id; });
|
2804
|
+
|
2805
|
+
// do not cache length because more watchers might be pushed
|
2806
|
+
// as we run existing watchers
|
2807
|
+
for (index = 0; index < queue.length; index++) {
|
2808
|
+
watcher = queue[index];
|
2809
|
+
id = watcher.id;
|
2810
|
+
has$1[id] = null;
|
2811
|
+
watcher.run();
|
2812
|
+
// in dev build, check and stop circular updates.
|
2813
|
+
if ("development" !== 'production' && has$1[id] != null) {
|
2814
|
+
circular[id] = (circular[id] || 0) + 1;
|
2815
|
+
if (circular[id] > config._maxUpdateCount) {
|
2816
|
+
warn(
|
2817
|
+
'You may have an infinite update loop ' + (
|
2818
|
+
watcher.user
|
2819
|
+
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
2820
|
+
: "in a component render function."
|
2821
|
+
),
|
2822
|
+
watcher.vm
|
2823
|
+
);
|
2824
|
+
break
|
2825
|
+
}
|
2826
|
+
}
|
2841
2827
|
}
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2828
|
+
|
2829
|
+
// call updated hooks
|
2830
|
+
index = queue.length;
|
2831
|
+
while (index--) {
|
2832
|
+
watcher = queue[index];
|
2833
|
+
vm = watcher.vm;
|
2834
|
+
if (vm._watcher === watcher && vm._isMounted) {
|
2835
|
+
callHook(vm, 'updated');
|
2836
|
+
}
|
2848
2837
|
}
|
2849
|
-
|
2850
|
-
|
2838
|
+
|
2839
|
+
// devtool hook
|
2840
|
+
/* istanbul ignore if */
|
2841
|
+
if (devtools && config.devtools) {
|
2842
|
+
devtools.emit('flush');
|
2851
2843
|
}
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2844
|
+
|
2845
|
+
resetSchedulerState();
|
2846
|
+
}
|
2847
|
+
|
2848
|
+
/**
|
2849
|
+
* Push a watcher into the watcher queue.
|
2850
|
+
* Jobs with duplicate IDs will be skipped unless it's
|
2851
|
+
* pushed when the queue is being flushed.
|
2852
|
+
*/
|
2853
|
+
function queueWatcher (watcher) {
|
2854
|
+
var id = watcher.id;
|
2855
|
+
if (has$1[id] == null) {
|
2856
|
+
has$1[id] = true;
|
2857
|
+
if (!flushing) {
|
2858
|
+
queue.push(watcher);
|
2865
2859
|
} else {
|
2866
|
-
//
|
2867
|
-
//
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2860
|
+
// if already flushing, splice the watcher based on its id
|
2861
|
+
// if already past its id, it will be run next immediately.
|
2862
|
+
var i = queue.length - 1;
|
2863
|
+
while (i >= 0 && queue[i].id > watcher.id) {
|
2864
|
+
i--;
|
2865
|
+
}
|
2866
|
+
queue.splice(Math.max(i, index) + 1, 0, watcher);
|
2867
|
+
}
|
2868
|
+
// queue the flush
|
2869
|
+
if (!waiting) {
|
2870
|
+
waiting = true;
|
2871
|
+
nextTick(flushSchedulerQueue);
|
2872
|
+
}
|
2873
|
+
}
|
2874
|
+
}
|
2875
|
+
|
2876
|
+
/* */
|
2877
|
+
|
2878
|
+
var uid$2 = 0;
|
2879
|
+
|
2880
|
+
/**
|
2881
|
+
* A watcher parses an expression, collects dependencies,
|
2882
|
+
* and fires callback when the expression value changes.
|
2883
|
+
* This is used for both the $watch() api and directives.
|
2884
|
+
*/
|
2885
|
+
var Watcher = function Watcher (
|
2886
|
+
vm,
|
2887
|
+
expOrFn,
|
2888
|
+
cb,
|
2889
|
+
options
|
2890
|
+
) {
|
2891
|
+
this.vm = vm;
|
2892
|
+
vm._watchers.push(this);
|
2893
|
+
// options
|
2894
|
+
if (options) {
|
2895
|
+
this.deep = !!options.deep;
|
2896
|
+
this.user = !!options.user;
|
2897
|
+
this.lazy = !!options.lazy;
|
2898
|
+
this.sync = !!options.sync;
|
2899
|
+
} else {
|
2900
|
+
this.deep = this.user = this.lazy = this.sync = false;
|
2901
|
+
}
|
2902
|
+
this.cb = cb;
|
2903
|
+
this.id = ++uid$2; // uid for batching
|
2904
|
+
this.active = true;
|
2905
|
+
this.dirty = this.lazy; // for lazy watchers
|
2906
|
+
this.deps = [];
|
2907
|
+
this.newDeps = [];
|
2908
|
+
this.depIds = new _Set();
|
2909
|
+
this.newDepIds = new _Set();
|
2910
|
+
this.expression = expOrFn.toString();
|
2911
|
+
// parse expression for getter
|
2912
|
+
if (typeof expOrFn === 'function') {
|
2913
|
+
this.getter = expOrFn;
|
2914
|
+
} else {
|
2915
|
+
this.getter = parsePath(expOrFn);
|
2916
|
+
if (!this.getter) {
|
2917
|
+
this.getter = function () {};
|
2918
|
+
"development" !== 'production' && warn(
|
2919
|
+
"Failed watching path: \"" + expOrFn + "\" " +
|
2920
|
+
'Watcher only accepts simple dot-delimited paths. ' +
|
2921
|
+
'For full control, use a function instead.',
|
2922
|
+
vm
|
2873
2923
|
);
|
2874
2924
|
}
|
2875
|
-
} else {
|
2876
|
-
// direct component options / constructor
|
2877
|
-
vnode = createComponent(tag, data, context, children);
|
2878
2925
|
}
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2926
|
+
this.value = this.lazy
|
2927
|
+
? undefined
|
2928
|
+
: this.get();
|
2929
|
+
};
|
2930
|
+
|
2931
|
+
/**
|
2932
|
+
* Evaluate the getter, and re-collect dependencies.
|
2933
|
+
*/
|
2934
|
+
Watcher.prototype.get = function get () {
|
2935
|
+
pushTarget(this);
|
2936
|
+
var value = this.getter.call(this.vm, this.vm);
|
2937
|
+
// "touch" every property so they are all tracked as
|
2938
|
+
// dependencies for deep watching
|
2939
|
+
if (this.deep) {
|
2940
|
+
traverse(value);
|
2884
2941
|
}
|
2885
|
-
|
2942
|
+
popTarget();
|
2943
|
+
this.cleanupDeps();
|
2944
|
+
return value
|
2945
|
+
};
|
2886
2946
|
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2947
|
+
/**
|
2948
|
+
* Add a dependency to this directive.
|
2949
|
+
*/
|
2950
|
+
Watcher.prototype.addDep = function addDep (dep) {
|
2951
|
+
var id = dep.id;
|
2952
|
+
if (!this.newDepIds.has(id)) {
|
2953
|
+
this.newDepIds.add(id);
|
2954
|
+
this.newDeps.push(dep);
|
2955
|
+
if (!this.depIds.has(id)) {
|
2956
|
+
dep.addSub(this);
|
2895
2957
|
}
|
2896
2958
|
}
|
2897
|
-
}
|
2959
|
+
};
|
2898
2960
|
|
2899
|
-
|
2961
|
+
/**
|
2962
|
+
* Clean up for dependency collection.
|
2963
|
+
*/
|
2964
|
+
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
2965
|
+
var this$1 = this;
|
2900
2966
|
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
|
2908
|
-
vm.$scopedSlots = {};
|
2909
|
-
// bind the createElement fn to this instance
|
2910
|
-
// so that we get proper render context inside it.
|
2911
|
-
// args order: tag, data, children, needNormalization, alwaysNormalize
|
2912
|
-
// internal version is used by render functions compiled from templates
|
2913
|
-
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
2914
|
-
// normalization is always applied for the public version, used in
|
2915
|
-
// user-written render functions.
|
2916
|
-
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
2917
|
-
if (vm.$options.el) {
|
2918
|
-
vm.$mount(vm.$options.el);
|
2967
|
+
var i = this.deps.length;
|
2968
|
+
while (i--) {
|
2969
|
+
var dep = this$1.deps[i];
|
2970
|
+
if (!this$1.newDepIds.has(dep.id)) {
|
2971
|
+
dep.removeSub(this$1);
|
2972
|
+
}
|
2919
2973
|
}
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2974
|
+
var tmp = this.depIds;
|
2975
|
+
this.depIds = this.newDepIds;
|
2976
|
+
this.newDepIds = tmp;
|
2977
|
+
this.newDepIds.clear();
|
2978
|
+
tmp = this.deps;
|
2979
|
+
this.deps = this.newDeps;
|
2980
|
+
this.newDeps = tmp;
|
2981
|
+
this.newDeps.length = 0;
|
2982
|
+
};
|
2926
2983
|
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2984
|
+
/**
|
2985
|
+
* Subscriber interface.
|
2986
|
+
* Will be called when a dependency changes.
|
2987
|
+
*/
|
2988
|
+
Watcher.prototype.update = function update () {
|
2989
|
+
/* istanbul ignore else */
|
2990
|
+
if (this.lazy) {
|
2991
|
+
this.dirty = true;
|
2992
|
+
} else if (this.sync) {
|
2993
|
+
this.run();
|
2994
|
+
} else {
|
2995
|
+
queueWatcher(this);
|
2996
|
+
}
|
2997
|
+
};
|
2933
2998
|
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2999
|
+
/**
|
3000
|
+
* Scheduler job interface.
|
3001
|
+
* Will be called by the scheduler.
|
3002
|
+
*/
|
3003
|
+
Watcher.prototype.run = function run () {
|
3004
|
+
if (this.active) {
|
3005
|
+
var value = this.get();
|
3006
|
+
if (
|
3007
|
+
value !== this.value ||
|
3008
|
+
// Deep watchers and watchers on Object/Arrays should fire even
|
3009
|
+
// when the value is the same, because the value may
|
3010
|
+
// have mutated.
|
3011
|
+
isObject(value) ||
|
3012
|
+
this.deep
|
3013
|
+
) {
|
3014
|
+
// set new value
|
3015
|
+
var oldValue = this.value;
|
3016
|
+
this.value = value;
|
3017
|
+
if (this.user) {
|
3018
|
+
try {
|
3019
|
+
this.cb.call(this.vm, value, oldValue);
|
3020
|
+
} catch (e) {
|
3021
|
+
/* istanbul ignore else */
|
3022
|
+
if (config.errorHandler) {
|
3023
|
+
config.errorHandler.call(null, e, this.vm);
|
3024
|
+
} else {
|
3025
|
+
"development" !== 'production' && warn(
|
3026
|
+
("Error in watcher \"" + (this.expression) + "\""),
|
3027
|
+
this.vm
|
3028
|
+
);
|
3029
|
+
throw e
|
3030
|
+
}
|
3031
|
+
}
|
3032
|
+
} else {
|
3033
|
+
this.cb.call(this.vm, value, oldValue);
|
2938
3034
|
}
|
2939
3035
|
}
|
3036
|
+
}
|
3037
|
+
};
|
2940
3038
|
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
3039
|
+
/**
|
3040
|
+
* Evaluate the value of the watcher.
|
3041
|
+
* This only gets called for lazy watchers.
|
3042
|
+
*/
|
3043
|
+
Watcher.prototype.evaluate = function evaluate () {
|
3044
|
+
this.value = this.get();
|
3045
|
+
this.dirty = false;
|
3046
|
+
};
|
2944
3047
|
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
vm.$vnode = _parentVnode;
|
2951
|
-
// render self
|
2952
|
-
var vnode;
|
2953
|
-
try {
|
2954
|
-
vnode = render.call(vm._renderProxy, vm.$createElement);
|
2955
|
-
} catch (e) {
|
2956
|
-
/* istanbul ignore else */
|
2957
|
-
if (config.errorHandler) {
|
2958
|
-
config.errorHandler.call(null, e, vm);
|
2959
|
-
} else {
|
2960
|
-
{
|
2961
|
-
warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
|
2962
|
-
}
|
2963
|
-
throw e
|
2964
|
-
}
|
2965
|
-
// return previous vnode to prevent render error causing blank component
|
2966
|
-
vnode = vm._vnode;
|
2967
|
-
}
|
2968
|
-
// return empty vnode in case the render function errored out
|
2969
|
-
if (!(vnode instanceof VNode)) {
|
2970
|
-
if ("development" !== 'production' && Array.isArray(vnode)) {
|
2971
|
-
warn(
|
2972
|
-
'Multiple root nodes returned from render function. Render function ' +
|
2973
|
-
'should return a single root node.',
|
2974
|
-
vm
|
2975
|
-
);
|
2976
|
-
}
|
2977
|
-
vnode = createEmptyVNode();
|
2978
|
-
}
|
2979
|
-
// set parent
|
2980
|
-
vnode.parent = _parentVnode;
|
2981
|
-
return vnode
|
2982
|
-
};
|
3048
|
+
/**
|
3049
|
+
* Depend on all deps collected by this watcher.
|
3050
|
+
*/
|
3051
|
+
Watcher.prototype.depend = function depend () {
|
3052
|
+
var this$1 = this;
|
2983
3053
|
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
Vue.prototype._n = toNumber;
|
2990
|
-
// empty vnode
|
2991
|
-
Vue.prototype._e = createEmptyVNode;
|
2992
|
-
// loose equal
|
2993
|
-
Vue.prototype._q = looseEqual;
|
2994
|
-
// loose indexOf
|
2995
|
-
Vue.prototype._i = looseIndexOf;
|
3054
|
+
var i = this.deps.length;
|
3055
|
+
while (i--) {
|
3056
|
+
this$1.deps[i].depend();
|
3057
|
+
}
|
3058
|
+
};
|
2996
3059
|
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
//
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
3060
|
+
/**
|
3061
|
+
* Remove self from all dependencies' subscriber list.
|
3062
|
+
*/
|
3063
|
+
Watcher.prototype.teardown = function teardown () {
|
3064
|
+
var this$1 = this;
|
3065
|
+
|
3066
|
+
if (this.active) {
|
3067
|
+
// remove self from vm's watcher list
|
3068
|
+
// this is a somewhat expensive operation so we skip it
|
3069
|
+
// if the vm is being destroyed.
|
3070
|
+
if (!this.vm._isBeingDestroyed) {
|
3071
|
+
remove$1(this.vm._watchers, this);
|
3072
|
+
}
|
3073
|
+
var i = this.deps.length;
|
3074
|
+
while (i--) {
|
3075
|
+
this$1.deps[i].removeSub(this$1);
|
3009
3076
|
}
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
return tree
|
3014
|
-
};
|
3077
|
+
this.active = false;
|
3078
|
+
}
|
3079
|
+
};
|
3015
3080
|
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3081
|
+
/**
|
3082
|
+
* Recursively traverse an object to evoke all converted
|
3083
|
+
* getters, so that every nested property inside the object
|
3084
|
+
* is collected as a "deep" dependency.
|
3085
|
+
*/
|
3086
|
+
var seenObjects = new _Set();
|
3087
|
+
function traverse (val) {
|
3088
|
+
seenObjects.clear();
|
3089
|
+
_traverse(val, seenObjects);
|
3090
|
+
}
|
3025
3091
|
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3092
|
+
function _traverse (val, seen) {
|
3093
|
+
var i, keys;
|
3094
|
+
var isA = Array.isArray(val);
|
3095
|
+
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
|
3096
|
+
return
|
3097
|
+
}
|
3098
|
+
if (val.__ob__) {
|
3099
|
+
var depId = val.__ob__.dep.id;
|
3100
|
+
if (seen.has(depId)) {
|
3101
|
+
return
|
3035
3102
|
}
|
3103
|
+
seen.add(depId);
|
3036
3104
|
}
|
3105
|
+
if (isA) {
|
3106
|
+
i = val.length;
|
3107
|
+
while (i--) { _traverse(val[i], seen); }
|
3108
|
+
} else {
|
3109
|
+
keys = Object.keys(val);
|
3110
|
+
i = keys.length;
|
3111
|
+
while (i--) { _traverse(val[keys[i]], seen); }
|
3112
|
+
}
|
3113
|
+
}
|
3037
3114
|
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3115
|
+
/* */
|
3116
|
+
|
3117
|
+
function initState (vm) {
|
3118
|
+
vm._watchers = [];
|
3119
|
+
var opts = vm.$options;
|
3120
|
+
if (opts.props) { initProps(vm, opts.props); }
|
3121
|
+
if (opts.methods) { initMethods(vm, opts.methods); }
|
3122
|
+
if (opts.data) {
|
3123
|
+
initData(vm);
|
3124
|
+
} else {
|
3125
|
+
observe(vm._data = {}, true /* asRootData */);
|
3042
3126
|
}
|
3127
|
+
if (opts.computed) { initComputed(vm, opts.computed); }
|
3128
|
+
if (opts.watch) { initWatch(vm, opts.watch); }
|
3129
|
+
}
|
3043
3130
|
|
3044
|
-
|
3045
|
-
Vue.prototype._f = function resolveFilter (id) {
|
3046
|
-
return resolveAsset(this.$options, 'filters', id, true) || identity
|
3047
|
-
};
|
3131
|
+
var isReservedProp = { key: 1, ref: 1, slot: 1 };
|
3048
3132
|
|
3049
|
-
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
}
|
3065
|
-
} else if (isObject(val)) {
|
3066
|
-
keys = Object.keys(val);
|
3067
|
-
ret = new Array(keys.length);
|
3068
|
-
for (i = 0, l = keys.length; i < l; i++) {
|
3069
|
-
key = keys[i];
|
3070
|
-
ret[i] = render(val[key], key, i);
|
3133
|
+
function initProps (vm, props) {
|
3134
|
+
var propsData = vm.$options.propsData || {};
|
3135
|
+
var keys = vm.$options._propKeys = Object.keys(props);
|
3136
|
+
var isRoot = !vm.$parent;
|
3137
|
+
// root instance props should be converted
|
3138
|
+
observerState.shouldConvert = isRoot;
|
3139
|
+
var loop = function ( i ) {
|
3140
|
+
var key = keys[i];
|
3141
|
+
/* istanbul ignore else */
|
3142
|
+
{
|
3143
|
+
if (isReservedProp[key]) {
|
3144
|
+
warn(
|
3145
|
+
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
|
3146
|
+
vm
|
3147
|
+
);
|
3071
3148
|
}
|
3149
|
+
defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
|
3150
|
+
if (vm.$parent && !observerState.isSettingProps) {
|
3151
|
+
warn(
|
3152
|
+
"Avoid mutating a prop directly since the value will be " +
|
3153
|
+
"overwritten whenever the parent component re-renders. " +
|
3154
|
+
"Instead, use a data or computed property based on the prop's " +
|
3155
|
+
"value. Prop being mutated: \"" + key + "\"",
|
3156
|
+
vm
|
3157
|
+
);
|
3158
|
+
}
|
3159
|
+
});
|
3072
3160
|
}
|
3073
|
-
return ret
|
3074
3161
|
};
|
3075
3162
|
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3163
|
+
for (var i = 0; i < keys.length; i++) loop( i );
|
3164
|
+
observerState.shouldConvert = true;
|
3165
|
+
}
|
3166
|
+
|
3167
|
+
function initData (vm) {
|
3168
|
+
var data = vm.$options.data;
|
3169
|
+
data = vm._data = typeof data === 'function'
|
3170
|
+
? data.call(vm)
|
3171
|
+
: data || {};
|
3172
|
+
if (!isPlainObject(data)) {
|
3173
|
+
data = {};
|
3174
|
+
"development" !== 'production' && warn(
|
3175
|
+
'data functions should return an object:\n' +
|
3176
|
+
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
3177
|
+
vm
|
3178
|
+
);
|
3179
|
+
}
|
3180
|
+
// proxy data on instance
|
3181
|
+
var keys = Object.keys(data);
|
3182
|
+
var props = vm.$options.props;
|
3183
|
+
var i = keys.length;
|
3184
|
+
while (i--) {
|
3185
|
+
if (props && hasOwn(props, keys[i])) {
|
3186
|
+
"development" !== 'production' && warn(
|
3187
|
+
"The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
|
3188
|
+
"Use prop default value instead.",
|
3189
|
+
vm
|
3190
|
+
);
|
3085
3191
|
} else {
|
3086
|
-
|
3087
|
-
// warn duplicate slot usage
|
3088
|
-
if (slotNodes && "development" !== 'production') {
|
3089
|
-
slotNodes._rendered && warn(
|
3090
|
-
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
|
3091
|
-
"- this will likely cause render errors.",
|
3092
|
-
this
|
3093
|
-
);
|
3094
|
-
slotNodes._rendered = true;
|
3095
|
-
}
|
3096
|
-
return slotNodes || fallback
|
3192
|
+
proxy(vm, keys[i]);
|
3097
3193
|
}
|
3098
|
-
}
|
3194
|
+
}
|
3195
|
+
// observe data
|
3196
|
+
observe(data, true /* asRootData */);
|
3197
|
+
}
|
3099
3198
|
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
) {
|
3107
|
-
if (value) {
|
3108
|
-
if (!isObject(value)) {
|
3109
|
-
"development" !== 'production' && warn(
|
3110
|
-
'v-bind without argument expects an Object or Array value',
|
3111
|
-
this
|
3112
|
-
);
|
3113
|
-
} else {
|
3114
|
-
if (Array.isArray(value)) {
|
3115
|
-
value = toObject(value);
|
3116
|
-
}
|
3117
|
-
for (var key in value) {
|
3118
|
-
if (key === 'class' || key === 'style') {
|
3119
|
-
data[key] = value[key];
|
3120
|
-
} else {
|
3121
|
-
var hash = asProp || config.mustUseProp(tag, key)
|
3122
|
-
? data.domProps || (data.domProps = {})
|
3123
|
-
: data.attrs || (data.attrs = {});
|
3124
|
-
hash[key] = value[key];
|
3125
|
-
}
|
3126
|
-
}
|
3127
|
-
}
|
3128
|
-
}
|
3129
|
-
return data
|
3130
|
-
};
|
3199
|
+
var computedSharedDefinition = {
|
3200
|
+
enumerable: true,
|
3201
|
+
configurable: true,
|
3202
|
+
get: noop,
|
3203
|
+
set: noop
|
3204
|
+
};
|
3131
3205
|
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
key
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3206
|
+
function initComputed (vm, computed) {
|
3207
|
+
for (var key in computed) {
|
3208
|
+
/* istanbul ignore if */
|
3209
|
+
if ("development" !== 'production' && key in vm) {
|
3210
|
+
warn(
|
3211
|
+
"existing instance property \"" + key + "\" will be " +
|
3212
|
+
"overwritten by a computed property with the same name.",
|
3213
|
+
vm
|
3214
|
+
);
|
3215
|
+
}
|
3216
|
+
var userDef = computed[key];
|
3217
|
+
if (typeof userDef === 'function') {
|
3218
|
+
computedSharedDefinition.get = makeComputedGetter(userDef, vm);
|
3219
|
+
computedSharedDefinition.set = noop;
|
3141
3220
|
} else {
|
3142
|
-
|
3221
|
+
computedSharedDefinition.get = userDef.get
|
3222
|
+
? userDef.cache !== false
|
3223
|
+
? makeComputedGetter(userDef.get, vm)
|
3224
|
+
: bind$1(userDef.get, vm)
|
3225
|
+
: noop;
|
3226
|
+
computedSharedDefinition.set = userDef.set
|
3227
|
+
? bind$1(userDef.set, vm)
|
3228
|
+
: noop;
|
3143
3229
|
}
|
3144
|
-
|
3230
|
+
Object.defineProperty(vm, key, computedSharedDefinition);
|
3231
|
+
}
|
3145
3232
|
}
|
3146
3233
|
|
3147
|
-
function
|
3148
|
-
|
3149
|
-
|
3150
|
-
)
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3234
|
+
function makeComputedGetter (getter, owner) {
|
3235
|
+
var watcher = new Watcher(owner, getter, noop, {
|
3236
|
+
lazy: true
|
3237
|
+
});
|
3238
|
+
return function computedGetter () {
|
3239
|
+
if (watcher.dirty) {
|
3240
|
+
watcher.evaluate();
|
3241
|
+
}
|
3242
|
+
if (Dep.target) {
|
3243
|
+
watcher.depend();
|
3244
|
+
}
|
3245
|
+
return watcher.value
|
3154
3246
|
}
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3247
|
+
}
|
3248
|
+
|
3249
|
+
function initMethods (vm, methods) {
|
3250
|
+
for (var key in methods) {
|
3251
|
+
vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
|
3252
|
+
if ("development" !== 'production' && methods[key] == null) {
|
3253
|
+
warn(
|
3254
|
+
"method \"" + key + "\" has an undefined value in the component definition. " +
|
3255
|
+
"Did you reference the function correctly?",
|
3256
|
+
vm
|
3257
|
+
);
|
3258
|
+
}
|
3259
|
+
}
|
3260
|
+
}
|
3261
|
+
|
3262
|
+
function initWatch (vm, watch) {
|
3263
|
+
for (var key in watch) {
|
3264
|
+
var handler = watch[key];
|
3265
|
+
if (Array.isArray(handler)) {
|
3266
|
+
for (var i = 0; i < handler.length; i++) {
|
3267
|
+
createWatcher(vm, key, handler[i]);
|
3168
3268
|
}
|
3169
3269
|
} else {
|
3170
|
-
|
3270
|
+
createWatcher(vm, key, handler);
|
3171
3271
|
}
|
3172
3272
|
}
|
3173
|
-
// ignore single whitespace
|
3174
|
-
if (defaultSlot.length && !(
|
3175
|
-
defaultSlot.length === 1 &&
|
3176
|
-
(defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
|
3177
|
-
)) {
|
3178
|
-
slots.default = defaultSlot;
|
3179
|
-
}
|
3180
|
-
return slots
|
3181
3273
|
}
|
3182
3274
|
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
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);
|
3275
|
+
function createWatcher (vm, key, handler) {
|
3276
|
+
var options;
|
3277
|
+
if (isPlainObject(handler)) {
|
3278
|
+
options = handler;
|
3279
|
+
handler = handler.handler;
|
3280
|
+
}
|
3281
|
+
if (typeof handler === 'string') {
|
3282
|
+
handler = vm[handler];
|
3198
3283
|
}
|
3284
|
+
vm.$watch(key, handler, options);
|
3199
3285
|
}
|
3200
3286
|
|
3201
|
-
function
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3287
|
+
function stateMixin (Vue) {
|
3288
|
+
// flow somehow has problems with directly declared definition object
|
3289
|
+
// when using Object.defineProperty, so we have to procedurally build up
|
3290
|
+
// the object here.
|
3291
|
+
var dataDef = {};
|
3292
|
+
dataDef.get = function () {
|
3293
|
+
return this._data
|
3205
3294
|
};
|
3295
|
+
{
|
3296
|
+
dataDef.set = function (newData) {
|
3297
|
+
warn(
|
3298
|
+
'Avoid replacing instance root $data. ' +
|
3299
|
+
'Use nested data properties instead.',
|
3300
|
+
this
|
3301
|
+
);
|
3302
|
+
};
|
3303
|
+
}
|
3304
|
+
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
3206
3305
|
|
3207
|
-
Vue.prototype.$
|
3208
|
-
|
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
|
-
};
|
3306
|
+
Vue.prototype.$set = set$1;
|
3307
|
+
Vue.prototype.$delete = del;
|
3217
3308
|
|
3218
|
-
Vue.prototype.$
|
3309
|
+
Vue.prototype.$watch = function (
|
3310
|
+
expOrFn,
|
3311
|
+
cb,
|
3312
|
+
options
|
3313
|
+
) {
|
3219
3314
|
var vm = this;
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
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
|
3315
|
+
options = options || {};
|
3316
|
+
options.user = true;
|
3317
|
+
var watcher = new Watcher(vm, expOrFn, cb, options);
|
3318
|
+
if (options.immediate) {
|
3319
|
+
cb.call(vm, watcher.value);
|
3233
3320
|
}
|
3234
|
-
|
3235
|
-
|
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
|
-
}
|
3321
|
+
return function unwatchFn () {
|
3322
|
+
watcher.teardown();
|
3243
3323
|
}
|
3244
|
-
return vm
|
3245
3324
|
};
|
3325
|
+
}
|
3246
3326
|
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3327
|
+
function proxy (vm, key) {
|
3328
|
+
if (!isReserved(key)) {
|
3329
|
+
Object.defineProperty(vm, key, {
|
3330
|
+
configurable: true,
|
3331
|
+
enumerable: true,
|
3332
|
+
get: function proxyGetter () {
|
3333
|
+
return vm._data[key]
|
3334
|
+
},
|
3335
|
+
set: function proxySetter (val) {
|
3336
|
+
vm._data[key] = val;
|
3255
3337
|
}
|
3256
|
-
}
|
3257
|
-
|
3258
|
-
};
|
3338
|
+
});
|
3339
|
+
}
|
3259
3340
|
}
|
3260
3341
|
|
3261
3342
|
/* */
|
@@ -3290,10 +3371,13 @@ function initMixin (Vue) {
|
|
3290
3371
|
vm._self = vm;
|
3291
3372
|
initLifecycle(vm);
|
3292
3373
|
initEvents(vm);
|
3374
|
+
initRender(vm);
|
3293
3375
|
callHook(vm, 'beforeCreate');
|
3294
3376
|
initState(vm);
|
3295
3377
|
callHook(vm, 'created');
|
3296
|
-
|
3378
|
+
if (vm.$options.el) {
|
3379
|
+
vm.$mount(vm.$options.el);
|
3380
|
+
}
|
3297
3381
|
};
|
3298
3382
|
}
|
3299
3383
|
|
@@ -3486,6 +3570,10 @@ function initAssetRegisters (Vue) {
|
|
3486
3570
|
|
3487
3571
|
var patternTypes = [String, RegExp];
|
3488
3572
|
|
3573
|
+
function getComponentName (opts) {
|
3574
|
+
return opts && (opts.Ctor.options.name || opts.tag)
|
3575
|
+
}
|
3576
|
+
|
3489
3577
|
function matches (pattern, name) {
|
3490
3578
|
if (typeof pattern === 'string') {
|
3491
3579
|
return pattern.split(',').indexOf(name) > -1
|
@@ -3494,22 +3582,64 @@ function matches (pattern, name) {
|
|
3494
3582
|
}
|
3495
3583
|
}
|
3496
3584
|
|
3585
|
+
function pruneCache (cache, filter) {
|
3586
|
+
for (var key in cache) {
|
3587
|
+
var cachedNode = cache[key];
|
3588
|
+
if (cachedNode) {
|
3589
|
+
var name = getComponentName(cachedNode.componentOptions);
|
3590
|
+
if (name && !filter(name)) {
|
3591
|
+
pruneCacheEntry(cachedNode);
|
3592
|
+
cache[key] = null;
|
3593
|
+
}
|
3594
|
+
}
|
3595
|
+
}
|
3596
|
+
}
|
3597
|
+
|
3598
|
+
function pruneCacheEntry (vnode) {
|
3599
|
+
if (vnode) {
|
3600
|
+
if (!vnode.componentInstance._inactive) {
|
3601
|
+
callHook(vnode.componentInstance, 'deactivated');
|
3602
|
+
}
|
3603
|
+
vnode.componentInstance.$destroy();
|
3604
|
+
}
|
3605
|
+
}
|
3606
|
+
|
3497
3607
|
var KeepAlive = {
|
3498
3608
|
name: 'keep-alive',
|
3499
3609
|
abstract: true,
|
3610
|
+
|
3500
3611
|
props: {
|
3501
3612
|
include: patternTypes,
|
3502
3613
|
exclude: patternTypes
|
3503
3614
|
},
|
3615
|
+
|
3504
3616
|
created: function created () {
|
3505
3617
|
this.cache = Object.create(null);
|
3506
3618
|
},
|
3619
|
+
|
3620
|
+
destroyed: function destroyed () {
|
3621
|
+
var this$1 = this;
|
3622
|
+
|
3623
|
+
for (var key in this.cache) {
|
3624
|
+
pruneCacheEntry(this$1.cache[key]);
|
3625
|
+
}
|
3626
|
+
},
|
3627
|
+
|
3628
|
+
watch: {
|
3629
|
+
include: function include (val) {
|
3630
|
+
pruneCache(this.cache, function (name) { return matches(val, name); });
|
3631
|
+
},
|
3632
|
+
exclude: function exclude (val) {
|
3633
|
+
pruneCache(this.cache, function (name) { return !matches(val, name); });
|
3634
|
+
}
|
3635
|
+
},
|
3636
|
+
|
3507
3637
|
render: function render () {
|
3508
3638
|
var vnode = getFirstComponentChild(this.$slots.default);
|
3509
|
-
|
3510
|
-
|
3639
|
+
var componentOptions = vnode && vnode.componentOptions;
|
3640
|
+
if (componentOptions) {
|
3511
3641
|
// check pattern
|
3512
|
-
var name =
|
3642
|
+
var name = getComponentName(componentOptions);
|
3513
3643
|
if (name && (
|
3514
3644
|
(this.include && !matches(this.include, name)) ||
|
3515
3645
|
(this.exclude && matches(this.exclude, name))
|
@@ -3519,25 +3649,16 @@ var KeepAlive = {
|
|
3519
3649
|
var key = vnode.key == null
|
3520
3650
|
// same constructor may get registered as different local components
|
3521
3651
|
// so cid alone is not enough (#3269)
|
3522
|
-
?
|
3652
|
+
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
3523
3653
|
: vnode.key;
|
3524
3654
|
if (this.cache[key]) {
|
3525
|
-
vnode.
|
3655
|
+
vnode.componentInstance = this.cache[key].componentInstance;
|
3526
3656
|
} else {
|
3527
3657
|
this.cache[key] = vnode;
|
3528
3658
|
}
|
3529
3659
|
vnode.data.keepAlive = true;
|
3530
3660
|
}
|
3531
3661
|
return vnode
|
3532
|
-
},
|
3533
|
-
destroyed: function destroyed () {
|
3534
|
-
var this$1 = this;
|
3535
|
-
|
3536
|
-
for (var key in this.cache) {
|
3537
|
-
var vnode = this$1.cache[key];
|
3538
|
-
callHook(vnode.child, 'deactivated');
|
3539
|
-
vnode.child.$destroy();
|
3540
|
-
}
|
3541
3662
|
}
|
3542
3663
|
};
|
3543
3664
|
|
@@ -3587,15 +3708,15 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
|
|
3587
3708
|
get: isServerRendering
|
3588
3709
|
});
|
3589
3710
|
|
3590
|
-
Vue$3.version = '2.1.
|
3711
|
+
Vue$3.version = '2.1.10';
|
3591
3712
|
|
3592
3713
|
/* */
|
3593
3714
|
|
3594
3715
|
// attributes that should be using props for binding
|
3595
3716
|
var acceptValue = makeMap('input,textarea,option,select');
|
3596
|
-
var mustUseProp = function (tag, attr) {
|
3717
|
+
var mustUseProp = function (tag, type, attr) {
|
3597
3718
|
return (
|
3598
|
-
(attr === 'value' && acceptValue(tag)) ||
|
3719
|
+
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
3599
3720
|
(attr === 'selected' && tag === 'option') ||
|
3600
3721
|
(attr === 'checked' && tag === 'input') ||
|
3601
3722
|
(attr === 'muted' && tag === 'video')
|
@@ -3633,8 +3754,8 @@ function genClassForVnode (vnode) {
|
|
3633
3754
|
var data = vnode.data;
|
3634
3755
|
var parentNode = vnode;
|
3635
3756
|
var childNode = vnode;
|
3636
|
-
while (childNode.
|
3637
|
-
childNode = childNode.
|
3757
|
+
while (childNode.componentInstance) {
|
3758
|
+
childNode = childNode.componentInstance._vnode;
|
3638
3759
|
if (childNode.data) {
|
3639
3760
|
data = mergeClassData(childNode.data, data);
|
3640
3761
|
}
|
@@ -3703,8 +3824,7 @@ function stringifyClass (value) {
|
|
3703
3824
|
|
3704
3825
|
var namespaceMap = {
|
3705
3826
|
svg: 'http://www.w3.org/2000/svg',
|
3706
|
-
math: 'http://www.w3.org/1998/Math/MathML'
|
3707
|
-
xhtml: 'http://www.w3.org/1999/xhtml'
|
3827
|
+
math: 'http://www.w3.org/1998/Math/MathML'
|
3708
3828
|
};
|
3709
3829
|
|
3710
3830
|
var isHTMLTag = makeMap(
|
@@ -3851,18 +3971,18 @@ function setAttribute (node, key, val) {
|
|
3851
3971
|
|
3852
3972
|
|
3853
3973
|
var nodeOps = Object.freeze({
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
|
3858
|
-
|
3859
|
-
|
3860
|
-
|
3861
|
-
|
3862
|
-
|
3863
|
-
|
3864
|
-
|
3865
|
-
|
3974
|
+
createElement: createElement$1,
|
3975
|
+
createElementNS: createElementNS,
|
3976
|
+
createTextNode: createTextNode,
|
3977
|
+
createComment: createComment,
|
3978
|
+
insertBefore: insertBefore,
|
3979
|
+
removeChild: removeChild,
|
3980
|
+
appendChild: appendChild,
|
3981
|
+
parentNode: parentNode,
|
3982
|
+
nextSibling: nextSibling,
|
3983
|
+
tagName: tagName,
|
3984
|
+
setTextContent: setTextContent,
|
3985
|
+
setAttribute: setAttribute
|
3866
3986
|
});
|
3867
3987
|
|
3868
3988
|
/* */
|
@@ -3887,7 +4007,7 @@ function registerRef (vnode, isRemoval) {
|
|
3887
4007
|
if (!key) { return }
|
3888
4008
|
|
3889
4009
|
var vm = vnode.context;
|
3890
|
-
var ref = vnode.
|
4010
|
+
var ref = vnode.componentInstance || vnode.elm;
|
3891
4011
|
var refs = vm.$refs;
|
3892
4012
|
if (isRemoval) {
|
3893
4013
|
if (Array.isArray(refs[key])) {
|
@@ -3974,16 +4094,16 @@ function createPatchFunction (backend) {
|
|
3974
4094
|
function createRmCb (childElm, listeners) {
|
3975
4095
|
function remove$$1 () {
|
3976
4096
|
if (--remove$$1.listeners === 0) {
|
3977
|
-
|
4097
|
+
removeNode(childElm);
|
3978
4098
|
}
|
3979
4099
|
}
|
3980
4100
|
remove$$1.listeners = listeners;
|
3981
4101
|
return remove$$1
|
3982
4102
|
}
|
3983
4103
|
|
3984
|
-
function
|
4104
|
+
function removeNode (el) {
|
3985
4105
|
var parent = nodeOps.parentNode(el);
|
3986
|
-
// element may have already been removed due to v-html
|
4106
|
+
// element may have already been removed due to v-html / v-text
|
3987
4107
|
if (parent) {
|
3988
4108
|
nodeOps.removeChild(parent, el);
|
3989
4109
|
}
|
@@ -4007,7 +4127,7 @@ function createPatchFunction (backend) {
|
|
4007
4127
|
if (
|
4008
4128
|
!inPre &&
|
4009
4129
|
!vnode.ns &&
|
4010
|
-
!(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
|
4130
|
+
!(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
|
4011
4131
|
config.isUnknownElement(tag)
|
4012
4132
|
) {
|
4013
4133
|
warn(
|
@@ -4047,7 +4167,7 @@ function createPatchFunction (backend) {
|
|
4047
4167
|
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
4048
4168
|
var i = vnode.data;
|
4049
4169
|
if (isDef(i)) {
|
4050
|
-
var isReactivated = isDef(vnode.
|
4170
|
+
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
4051
4171
|
if (isDef(i = i.hook) && isDef(i = i.init)) {
|
4052
4172
|
i(vnode, false /* hydrating */, parentElm, refElm);
|
4053
4173
|
}
|
@@ -4055,7 +4175,7 @@ function createPatchFunction (backend) {
|
|
4055
4175
|
// it should've created a child instance and mounted it. the child
|
4056
4176
|
// component also has set the placeholder vnode's elm.
|
4057
4177
|
// in that case we can just return the element and be done.
|
4058
|
-
if (isDef(vnode.
|
4178
|
+
if (isDef(vnode.componentInstance)) {
|
4059
4179
|
initComponent(vnode, insertedVnodeQueue);
|
4060
4180
|
if (isReactivated) {
|
4061
4181
|
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
@@ -4065,6 +4185,23 @@ function createPatchFunction (backend) {
|
|
4065
4185
|
}
|
4066
4186
|
}
|
4067
4187
|
|
4188
|
+
function initComponent (vnode, insertedVnodeQueue) {
|
4189
|
+
if (vnode.data.pendingInsert) {
|
4190
|
+
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
4191
|
+
}
|
4192
|
+
vnode.elm = vnode.componentInstance.$el;
|
4193
|
+
if (isPatchable(vnode)) {
|
4194
|
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
4195
|
+
setScope(vnode);
|
4196
|
+
} else {
|
4197
|
+
// empty component root.
|
4198
|
+
// skip all element-related modules except for ref (#3455)
|
4199
|
+
registerRef(vnode);
|
4200
|
+
// make sure to invoke the insert hook
|
4201
|
+
insertedVnodeQueue.push(vnode);
|
4202
|
+
}
|
4203
|
+
}
|
4204
|
+
|
4068
4205
|
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
4069
4206
|
var i;
|
4070
4207
|
// hack for #4339: a reactivated component with inner transition
|
@@ -4072,8 +4209,8 @@ function createPatchFunction (backend) {
|
|
4072
4209
|
// again. It's not ideal to involve module-specific logic in here but
|
4073
4210
|
// there doesn't seem to be a better way to do it.
|
4074
4211
|
var innerNode = vnode;
|
4075
|
-
while (innerNode.
|
4076
|
-
innerNode = innerNode.
|
4212
|
+
while (innerNode.componentInstance) {
|
4213
|
+
innerNode = innerNode.componentInstance._vnode;
|
4077
4214
|
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
4078
4215
|
for (i = 0; i < cbs.activate.length; ++i) {
|
4079
4216
|
cbs.activate[i](emptyNode, innerNode);
|
@@ -4108,8 +4245,8 @@ function createPatchFunction (backend) {
|
|
4108
4245
|
}
|
4109
4246
|
|
4110
4247
|
function isPatchable (vnode) {
|
4111
|
-
while (vnode.
|
4112
|
-
vnode = vnode.
|
4248
|
+
while (vnode.componentInstance) {
|
4249
|
+
vnode = vnode.componentInstance._vnode;
|
4113
4250
|
}
|
4114
4251
|
return isDef(vnode.tag)
|
4115
4252
|
}
|
@@ -4125,23 +4262,6 @@ function createPatchFunction (backend) {
|
|
4125
4262
|
}
|
4126
4263
|
}
|
4127
4264
|
|
4128
|
-
function initComponent (vnode, insertedVnodeQueue) {
|
4129
|
-
if (vnode.data.pendingInsert) {
|
4130
|
-
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
4131
|
-
}
|
4132
|
-
vnode.elm = vnode.child.$el;
|
4133
|
-
if (isPatchable(vnode)) {
|
4134
|
-
invokeCreateHooks(vnode, insertedVnodeQueue);
|
4135
|
-
setScope(vnode);
|
4136
|
-
} else {
|
4137
|
-
// empty component root.
|
4138
|
-
// skip all element-related modules except for ref (#3455)
|
4139
|
-
registerRef(vnode);
|
4140
|
-
// make sure to invoke the insert hook
|
4141
|
-
insertedVnodeQueue.push(vnode);
|
4142
|
-
}
|
4143
|
-
}
|
4144
|
-
|
4145
4265
|
// set scope id attribute for scoped CSS.
|
4146
4266
|
// this is implemented as a special case to avoid the overhead
|
4147
4267
|
// of going through the normal attribute patching process.
|
@@ -4185,7 +4305,7 @@ function createPatchFunction (backend) {
|
|
4185
4305
|
removeAndInvokeRemoveHook(ch);
|
4186
4306
|
invokeDestroyHook(ch);
|
4187
4307
|
} else { // Text node
|
4188
|
-
|
4308
|
+
removeNode(ch.elm);
|
4189
4309
|
}
|
4190
4310
|
}
|
4191
4311
|
}
|
@@ -4203,7 +4323,7 @@ function createPatchFunction (backend) {
|
|
4203
4323
|
rm.listeners += listeners;
|
4204
4324
|
}
|
4205
4325
|
// recursively invoke hooks on child component root node
|
4206
|
-
if (isDef(i = vnode.
|
4326
|
+
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
4207
4327
|
removeAndInvokeRemoveHook(i, rm);
|
4208
4328
|
}
|
4209
4329
|
for (i = 0; i < cbs.remove.length; ++i) {
|
@@ -4215,7 +4335,7 @@ function createPatchFunction (backend) {
|
|
4215
4335
|
rm();
|
4216
4336
|
}
|
4217
4337
|
} else {
|
4218
|
-
|
4338
|
+
removeNode(vnode.elm);
|
4219
4339
|
}
|
4220
4340
|
}
|
4221
4341
|
|
@@ -4307,7 +4427,7 @@ function createPatchFunction (backend) {
|
|
4307
4427
|
vnode.key === oldVnode.key &&
|
4308
4428
|
(vnode.isCloned || vnode.isOnce)) {
|
4309
4429
|
vnode.elm = oldVnode.elm;
|
4310
|
-
vnode.
|
4430
|
+
vnode.componentInstance = oldVnode.componentInstance;
|
4311
4431
|
return
|
4312
4432
|
}
|
4313
4433
|
var i;
|
@@ -4372,7 +4492,7 @@ function createPatchFunction (backend) {
|
|
4372
4492
|
var children = vnode.children;
|
4373
4493
|
if (isDef(data)) {
|
4374
4494
|
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
|
4375
|
-
if (isDef(i = vnode.
|
4495
|
+
if (isDef(i = vnode.componentInstance)) {
|
4376
4496
|
// child component. it should have hydrated its own tree.
|
4377
4497
|
initComponent(vnode, insertedVnodeQueue);
|
4378
4498
|
return true
|
@@ -4415,6 +4535,8 @@ function createPatchFunction (backend) {
|
|
4415
4535
|
}
|
4416
4536
|
}
|
4417
4537
|
}
|
4538
|
+
} else if (elm.data !== vnode.text) {
|
4539
|
+
elm.data = vnode.text;
|
4418
4540
|
}
|
4419
4541
|
return true
|
4420
4542
|
}
|
@@ -4426,7 +4548,7 @@ function createPatchFunction (backend) {
|
|
4426
4548
|
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
4427
4549
|
)
|
4428
4550
|
} else {
|
4429
|
-
return
|
4551
|
+
return node.nodeType === (vnode.isComment ? 8 : 3)
|
4430
4552
|
}
|
4431
4553
|
}
|
4432
4554
|
|
@@ -4436,7 +4558,6 @@ function createPatchFunction (backend) {
|
|
4436
4558
|
return
|
4437
4559
|
}
|
4438
4560
|
|
4439
|
-
var elm, parent;
|
4440
4561
|
var isInitialPatch = false;
|
4441
4562
|
var insertedVnodeQueue = [];
|
4442
4563
|
|
@@ -4476,11 +4597,18 @@ function createPatchFunction (backend) {
|
|
4476
4597
|
// create an empty node and replace it
|
4477
4598
|
oldVnode = emptyNodeAt(oldVnode);
|
4478
4599
|
}
|
4479
|
-
|
4480
4600
|
// replacing existing element
|
4481
|
-
|
4482
|
-
|
4483
|
-
createElm(
|
4601
|
+
var oldElm = oldVnode.elm;
|
4602
|
+
var parentElm$1 = nodeOps.parentNode(oldElm);
|
4603
|
+
createElm(
|
4604
|
+
vnode,
|
4605
|
+
insertedVnodeQueue,
|
4606
|
+
// extremely rare edge case: do not insert if old element is in a
|
4607
|
+
// leaving transition. Only happens when combining transition +
|
4608
|
+
// keep-alive + HOCs. (#4590)
|
4609
|
+
oldElm._leaveCb ? null : parentElm$1,
|
4610
|
+
nodeOps.nextSibling(oldElm)
|
4611
|
+
);
|
4484
4612
|
|
4485
4613
|
if (vnode.parent) {
|
4486
4614
|
// component root element replaced.
|
@@ -4497,8 +4625,8 @@ function createPatchFunction (backend) {
|
|
4497
4625
|
}
|
4498
4626
|
}
|
4499
4627
|
|
4500
|
-
if (
|
4501
|
-
removeVnodes(
|
4628
|
+
if (parentElm$1 !== null) {
|
4629
|
+
removeVnodes(parentElm$1, [oldVnode], 0, 0);
|
4502
4630
|
} else if (isDef(oldVnode.tag)) {
|
4503
4631
|
invokeDestroyHook(oldVnode);
|
4504
4632
|
}
|
@@ -4528,6 +4656,7 @@ function updateDirectives (oldVnode, vnode) {
|
|
4528
4656
|
|
4529
4657
|
function _update (oldVnode, vnode) {
|
4530
4658
|
var isCreate = oldVnode === emptyNode;
|
4659
|
+
var isDestroy = vnode === emptyNode;
|
4531
4660
|
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
4532
4661
|
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
4533
4662
|
|
@@ -4579,7 +4708,7 @@ function _update (oldVnode, vnode) {
|
|
4579
4708
|
for (key in oldDirs) {
|
4580
4709
|
if (!newDirs[key]) {
|
4581
4710
|
// no longer present, unbind
|
4582
|
-
callHook$1(oldDirs[key], 'unbind', oldVnode);
|
4711
|
+
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
4583
4712
|
}
|
4584
4713
|
}
|
4585
4714
|
}
|
@@ -4611,10 +4740,10 @@ function getRawDirName (dir) {
|
|
4611
4740
|
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
4612
4741
|
}
|
4613
4742
|
|
4614
|
-
function callHook$1 (dir, hook, vnode, oldVnode) {
|
4743
|
+
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
4615
4744
|
var fn = dir.def && dir.def[hook];
|
4616
4745
|
if (fn) {
|
4617
|
-
fn(vnode.elm, dir, vnode, oldVnode);
|
4746
|
+
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
4618
4747
|
}
|
4619
4748
|
}
|
4620
4749
|
|
@@ -4725,23 +4854,34 @@ var klass = {
|
|
4725
4854
|
|
4726
4855
|
/* */
|
4727
4856
|
|
4728
|
-
var target;
|
4857
|
+
var target$1;
|
4729
4858
|
|
4730
|
-
function add$
|
4859
|
+
function add$2 (
|
4860
|
+
event,
|
4861
|
+
handler,
|
4862
|
+
once,
|
4863
|
+
capture
|
4864
|
+
) {
|
4731
4865
|
if (once) {
|
4732
4866
|
var oldHandler = handler;
|
4867
|
+
var _target = target$1; // save current target element in closure
|
4733
4868
|
handler = function (ev) {
|
4734
|
-
remove$
|
4869
|
+
remove$3(event, handler, capture, _target);
|
4735
4870
|
arguments.length === 1
|
4736
4871
|
? oldHandler(ev)
|
4737
4872
|
: oldHandler.apply(null, arguments);
|
4738
4873
|
};
|
4739
4874
|
}
|
4740
|
-
target.addEventListener(event, handler, capture);
|
4875
|
+
target$1.addEventListener(event, handler, capture);
|
4741
4876
|
}
|
4742
4877
|
|
4743
|
-
function remove$
|
4744
|
-
|
4878
|
+
function remove$3 (
|
4879
|
+
event,
|
4880
|
+
handler,
|
4881
|
+
capture,
|
4882
|
+
_target
|
4883
|
+
) {
|
4884
|
+
(_target || target$1).removeEventListener(event, handler, capture);
|
4745
4885
|
}
|
4746
4886
|
|
4747
4887
|
function updateDOMListeners (oldVnode, vnode) {
|
@@ -4750,8 +4890,8 @@ function updateDOMListeners (oldVnode, vnode) {
|
|
4750
4890
|
}
|
4751
4891
|
var on = vnode.data.on || {};
|
4752
4892
|
var oldOn = oldVnode.data.on || {};
|
4753
|
-
target = vnode.elm;
|
4754
|
-
updateListeners(on, oldOn, add$
|
4893
|
+
target$1 = vnode.elm;
|
4894
|
+
updateListeners(on, oldOn, add$2, remove$3, vnode.context);
|
4755
4895
|
}
|
4756
4896
|
|
4757
4897
|
var events = {
|
@@ -4788,16 +4928,14 @@ function updateDOMProps (oldVnode, vnode) {
|
|
4788
4928
|
if (vnode.children) { vnode.children.length = 0; }
|
4789
4929
|
if (cur === oldProps[key]) { continue }
|
4790
4930
|
}
|
4931
|
+
|
4791
4932
|
if (key === 'value') {
|
4792
4933
|
// store value as _value as well since
|
4793
4934
|
// non-string values will be stringified
|
4794
4935
|
elm._value = cur;
|
4795
4936
|
// avoid resetting cursor position when value is the same
|
4796
4937
|
var strCur = cur == null ? '' : String(cur);
|
4797
|
-
if (
|
4798
|
-
(document.activeElement !== elm && elm.value !== strCur) ||
|
4799
|
-
isValueChanged(vnode, strCur)
|
4800
|
-
)) {
|
4938
|
+
if (shouldUpdateValue(elm, vnode, strCur)) {
|
4801
4939
|
elm.value = strCur;
|
4802
4940
|
}
|
4803
4941
|
} else {
|
@@ -4806,7 +4944,27 @@ function updateDOMProps (oldVnode, vnode) {
|
|
4806
4944
|
}
|
4807
4945
|
}
|
4808
4946
|
|
4809
|
-
|
4947
|
+
// check platforms/web/util/attrs.js acceptValue
|
4948
|
+
|
4949
|
+
|
4950
|
+
function shouldUpdateValue (
|
4951
|
+
elm,
|
4952
|
+
vnode,
|
4953
|
+
checkVal
|
4954
|
+
) {
|
4955
|
+
return (!elm.composing && (
|
4956
|
+
vnode.tag === 'option' ||
|
4957
|
+
isDirty(elm, checkVal) ||
|
4958
|
+
isInputChanged(vnode, checkVal)
|
4959
|
+
))
|
4960
|
+
}
|
4961
|
+
|
4962
|
+
function isDirty (elm, checkVal) {
|
4963
|
+
// return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
|
4964
|
+
return document.activeElement !== elm && elm.value !== checkVal
|
4965
|
+
}
|
4966
|
+
|
4967
|
+
function isInputChanged (vnode, newVal) {
|
4810
4968
|
var value = vnode.elm.value;
|
4811
4969
|
var modifiers = vnode.elm._vModifiers; // injected by v-model runtime
|
4812
4970
|
if ((modifiers && modifiers.number) || vnode.elm.type === 'number') {
|
@@ -4869,8 +5027,8 @@ function getStyle (vnode, checkChild) {
|
|
4869
5027
|
|
4870
5028
|
if (checkChild) {
|
4871
5029
|
var childNode = vnode;
|
4872
|
-
while (childNode.
|
4873
|
-
childNode = childNode.
|
5030
|
+
while (childNode.componentInstance) {
|
5031
|
+
childNode = childNode.componentInstance._vnode;
|
4874
5032
|
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
|
4875
5033
|
extend(res, styleData);
|
4876
5034
|
}
|
@@ -5044,7 +5202,11 @@ if (hasTransition) {
|
|
5044
5202
|
}
|
5045
5203
|
}
|
5046
5204
|
|
5047
|
-
|
5205
|
+
// binding to window is necessary to make hot reload work in IE in strict mode
|
5206
|
+
var raf = inBrowser && window.requestAnimationFrame
|
5207
|
+
? window.requestAnimationFrame.bind(window)
|
5208
|
+
: setTimeout;
|
5209
|
+
|
5048
5210
|
function nextFrame (fn) {
|
5049
5211
|
raf(function () {
|
5050
5212
|
raf(fn);
|
@@ -5184,8 +5346,10 @@ function enter (vnode, toggleDisplay) {
|
|
5184
5346
|
var css = data.css;
|
5185
5347
|
var type = data.type;
|
5186
5348
|
var enterClass = data.enterClass;
|
5349
|
+
var enterToClass = data.enterToClass;
|
5187
5350
|
var enterActiveClass = data.enterActiveClass;
|
5188
5351
|
var appearClass = data.appearClass;
|
5352
|
+
var appearToClass = data.appearToClass;
|
5189
5353
|
var appearActiveClass = data.appearActiveClass;
|
5190
5354
|
var beforeEnter = data.beforeEnter;
|
5191
5355
|
var enter = data.enter;
|
@@ -5215,6 +5379,7 @@ function enter (vnode, toggleDisplay) {
|
|
5215
5379
|
|
5216
5380
|
var startClass = isAppear ? appearClass : enterClass;
|
5217
5381
|
var activeClass = isAppear ? appearActiveClass : enterActiveClass;
|
5382
|
+
var toClass = isAppear ? appearToClass : enterToClass;
|
5218
5383
|
var beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter;
|
5219
5384
|
var enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter;
|
5220
5385
|
var afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter;
|
@@ -5229,6 +5394,7 @@ function enter (vnode, toggleDisplay) {
|
|
5229
5394
|
|
5230
5395
|
var cb = el._enterCb = once(function () {
|
5231
5396
|
if (expectsCSS) {
|
5397
|
+
removeTransitionClass(el, toClass);
|
5232
5398
|
removeTransitionClass(el, activeClass);
|
5233
5399
|
}
|
5234
5400
|
if (cb.cancelled) {
|
@@ -5248,7 +5414,6 @@ function enter (vnode, toggleDisplay) {
|
|
5248
5414
|
var parent = el.parentNode;
|
5249
5415
|
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
5250
5416
|
if (pendingNode &&
|
5251
|
-
pendingNode.context === vnode.context &&
|
5252
5417
|
pendingNode.tag === vnode.tag &&
|
5253
5418
|
pendingNode.elm._leaveCb) {
|
5254
5419
|
pendingNode.elm._leaveCb();
|
@@ -5263,6 +5428,7 @@ function enter (vnode, toggleDisplay) {
|
|
5263
5428
|
addTransitionClass(el, startClass);
|
5264
5429
|
addTransitionClass(el, activeClass);
|
5265
5430
|
nextFrame(function () {
|
5431
|
+
addTransitionClass(el, toClass);
|
5266
5432
|
removeTransitionClass(el, startClass);
|
5267
5433
|
if (!cb.cancelled && !userWantsControl) {
|
5268
5434
|
whenTransitionEnds(el, type, cb);
|
@@ -5302,6 +5468,7 @@ function leave (vnode, rm) {
|
|
5302
5468
|
var css = data.css;
|
5303
5469
|
var type = data.type;
|
5304
5470
|
var leaveClass = data.leaveClass;
|
5471
|
+
var leaveToClass = data.leaveToClass;
|
5305
5472
|
var leaveActiveClass = data.leaveActiveClass;
|
5306
5473
|
var beforeLeave = data.beforeLeave;
|
5307
5474
|
var leave = data.leave;
|
@@ -5321,6 +5488,7 @@ function leave (vnode, rm) {
|
|
5321
5488
|
el.parentNode._pending[vnode.key] = null;
|
5322
5489
|
}
|
5323
5490
|
if (expectsCSS) {
|
5491
|
+
removeTransitionClass(el, leaveToClass);
|
5324
5492
|
removeTransitionClass(el, leaveActiveClass);
|
5325
5493
|
}
|
5326
5494
|
if (cb.cancelled) {
|
@@ -5355,6 +5523,7 @@ function leave (vnode, rm) {
|
|
5355
5523
|
addTransitionClass(el, leaveClass);
|
5356
5524
|
addTransitionClass(el, leaveActiveClass);
|
5357
5525
|
nextFrame(function () {
|
5526
|
+
addTransitionClass(el, leaveToClass);
|
5358
5527
|
removeTransitionClass(el, leaveClass);
|
5359
5528
|
if (!cb.cancelled && !userWantsControl) {
|
5360
5529
|
whenTransitionEnds(el, type, cb);
|
@@ -5390,6 +5559,9 @@ var autoCssTransition = cached(function (name) {
|
|
5390
5559
|
enterClass: (name + "-enter"),
|
5391
5560
|
leaveClass: (name + "-leave"),
|
5392
5561
|
appearClass: (name + "-enter"),
|
5562
|
+
enterToClass: (name + "-enter-to"),
|
5563
|
+
leaveToClass: (name + "-leave-to"),
|
5564
|
+
appearToClass: (name + "-enter-to"),
|
5393
5565
|
enterActiveClass: (name + "-enter-active"),
|
5394
5566
|
leaveActiveClass: (name + "-leave-active"),
|
5395
5567
|
appearActiveClass: (name + "-enter-active")
|
@@ -5579,8 +5751,8 @@ function trigger (el, type) {
|
|
5579
5751
|
|
5580
5752
|
// recursively search for possible transition defined inside the component root
|
5581
5753
|
function locateNode (vnode) {
|
5582
|
-
return vnode.
|
5583
|
-
? locateNode(vnode.
|
5754
|
+
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
5755
|
+
? locateNode(vnode.componentInstance._vnode)
|
5584
5756
|
: vnode
|
5585
5757
|
}
|
5586
5758
|
|
@@ -5601,6 +5773,7 @@ var show = {
|
|
5601
5773
|
el.style.display = value ? originalDisplay : 'none';
|
5602
5774
|
}
|
5603
5775
|
},
|
5776
|
+
|
5604
5777
|
update: function update (el, ref, vnode) {
|
5605
5778
|
var value = ref.value;
|
5606
5779
|
var oldValue = ref.oldValue;
|
@@ -5623,6 +5796,18 @@ var show = {
|
|
5623
5796
|
} else {
|
5624
5797
|
el.style.display = value ? el.__vOriginalDisplay : 'none';
|
5625
5798
|
}
|
5799
|
+
},
|
5800
|
+
|
5801
|
+
unbind: function unbind (
|
5802
|
+
el,
|
5803
|
+
binding,
|
5804
|
+
vnode,
|
5805
|
+
oldVnode,
|
5806
|
+
isDestroy
|
5807
|
+
) {
|
5808
|
+
if (!isDestroy) {
|
5809
|
+
el.style.display = el.__vOriginalDisplay;
|
5810
|
+
}
|
5626
5811
|
}
|
5627
5812
|
};
|
5628
5813
|
|
@@ -5644,10 +5829,13 @@ var transitionProps = {
|
|
5644
5829
|
type: String,
|
5645
5830
|
enterClass: String,
|
5646
5831
|
leaveClass: String,
|
5832
|
+
enterToClass: String,
|
5833
|
+
leaveToClass: String,
|
5647
5834
|
enterActiveClass: String,
|
5648
5835
|
leaveActiveClass: String,
|
5649
5836
|
appearClass: String,
|
5650
|
-
appearActiveClass: String
|
5837
|
+
appearActiveClass: String,
|
5838
|
+
appearToClass: String
|
5651
5839
|
};
|
5652
5840
|
|
5653
5841
|
// in case the child is also an abstract component, e.g. <keep-alive>
|
@@ -5691,10 +5879,15 @@ function hasParentTransition (vnode) {
|
|
5691
5879
|
}
|
5692
5880
|
}
|
5693
5881
|
|
5882
|
+
function isSameChild (child, oldChild) {
|
5883
|
+
return oldChild.key === child.key && oldChild.tag === child.tag
|
5884
|
+
}
|
5885
|
+
|
5694
5886
|
var Transition = {
|
5695
5887
|
name: 'transition',
|
5696
5888
|
props: transitionProps,
|
5697
5889
|
abstract: true,
|
5890
|
+
|
5698
5891
|
render: function render (h) {
|
5699
5892
|
var this$1 = this;
|
5700
5893
|
|
@@ -5750,9 +5943,15 @@ var Transition = {
|
|
5750
5943
|
return placeholder(h, rawChild)
|
5751
5944
|
}
|
5752
5945
|
|
5753
|
-
|
5754
|
-
|
5755
|
-
|
5946
|
+
// ensure a key that is unique to the vnode type and to this transition
|
5947
|
+
// component instance. This key will be used to remove pending leaving nodes
|
5948
|
+
// during entering.
|
5949
|
+
var id = "__transition-" + (this._uid) + "-";
|
5950
|
+
var key = child.key = child.key == null
|
5951
|
+
? id + child.tag
|
5952
|
+
: isPrimitive(child.key)
|
5953
|
+
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
5954
|
+
: child.key;
|
5756
5955
|
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
5757
5956
|
var oldRawChild = this._vnode;
|
5758
5957
|
var oldChild = getRealChild(oldRawChild);
|
@@ -5763,11 +5962,10 @@ var Transition = {
|
|
5763
5962
|
child.data.show = true;
|
5764
5963
|
}
|
5765
5964
|
|
5766
|
-
if (oldChild && oldChild.data && oldChild
|
5965
|
+
if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
|
5767
5966
|
// replace old child transition data with fresh one
|
5768
5967
|
// important for dynamic transitions!
|
5769
|
-
var oldData = oldChild.data.transition = extend({}, data);
|
5770
|
-
|
5968
|
+
var oldData = oldChild && (oldChild.data.transition = extend({}, data));
|
5771
5969
|
// handle transition mode
|
5772
5970
|
if (mode === 'out-in') {
|
5773
5971
|
// return placeholder node and queue update when leave finishes
|
@@ -5978,6 +6176,15 @@ Vue$3.prototype.$mount = function (
|
|
5978
6176
|
return this._mount(el, hydrating)
|
5979
6177
|
};
|
5980
6178
|
|
6179
|
+
if ("development" !== 'production' &&
|
6180
|
+
inBrowser && typeof console !== 'undefined') {
|
6181
|
+
console[console.info ? 'info' : 'log'](
|
6182
|
+
"You are running Vue in development mode.\n" +
|
6183
|
+
"Make sure to turn on production mode when deploying for production.\n" +
|
6184
|
+
"See more tips at https://vuejs.org/guide/deployment.html"
|
6185
|
+
);
|
6186
|
+
}
|
6187
|
+
|
5981
6188
|
// devtools global hook
|
5982
6189
|
/* istanbul ignore next */
|
5983
6190
|
setTimeout(function () {
|
@@ -5988,8 +6195,8 @@ setTimeout(function () {
|
|
5988
6195
|
"development" !== 'production' &&
|
5989
6196
|
inBrowser && !isEdge && /Chrome\/\d+/.test(window.navigator.userAgent)
|
5990
6197
|
) {
|
5991
|
-
console.log(
|
5992
|
-
'Download the Vue Devtools for a better development experience:\n' +
|
6198
|
+
console[console.info ? 'info' : 'log'](
|
6199
|
+
'Download the Vue Devtools extension for a better development experience:\n' +
|
5993
6200
|
'https://github.com/vuejs/vue-devtools'
|
5994
6201
|
);
|
5995
6202
|
}
|
@@ -6091,22 +6298,6 @@ var IS_REGEX_CAPTURING_BROKEN = false;
|
|
6091
6298
|
|
6092
6299
|
// Special Elements (can contain anything)
|
6093
6300
|
var isScriptOrStyle = makeMap('script,style', true);
|
6094
|
-
var hasLang = function (attr) { return attr.name === 'lang' && attr.value !== 'html'; };
|
6095
|
-
var isSpecialTag = function (tag, isSFC, stack) {
|
6096
|
-
if (isScriptOrStyle(tag)) {
|
6097
|
-
return true
|
6098
|
-
}
|
6099
|
-
if (isSFC && stack.length === 1) {
|
6100
|
-
// top-level template that has no pre-processor
|
6101
|
-
if (tag === 'template' && !stack[0].attrs.some(hasLang)) {
|
6102
|
-
return false
|
6103
|
-
} else {
|
6104
|
-
return true
|
6105
|
-
}
|
6106
|
-
}
|
6107
|
-
return false
|
6108
|
-
};
|
6109
|
-
|
6110
6301
|
var reCache = {};
|
6111
6302
|
|
6112
6303
|
var ltRE = /</g;
|
@@ -6135,7 +6326,7 @@ function parseHTML (html, options) {
|
|
6135
6326
|
while (html) {
|
6136
6327
|
last = html;
|
6137
6328
|
// Make sure we're not in a script or style element
|
6138
|
-
if (!lastTag || !
|
6329
|
+
if (!lastTag || !isScriptOrStyle(lastTag)) {
|
6139
6330
|
var textEnd = html.indexOf('<');
|
6140
6331
|
if (textEnd === 0) {
|
6141
6332
|
// Comment:
|
@@ -6170,7 +6361,7 @@ function parseHTML (html, options) {
|
|
6170
6361
|
if (endTagMatch) {
|
6171
6362
|
var curIndex = index;
|
6172
6363
|
advance(endTagMatch[0].length);
|
6173
|
-
parseEndTag(endTagMatch[
|
6364
|
+
parseEndTag(endTagMatch[1], curIndex, index);
|
6174
6365
|
continue
|
6175
6366
|
}
|
6176
6367
|
|
@@ -6227,7 +6418,7 @@ function parseHTML (html, options) {
|
|
6227
6418
|
});
|
6228
6419
|
index += html.length - rest.length;
|
6229
6420
|
html = rest;
|
6230
|
-
parseEndTag(
|
6421
|
+
parseEndTag(stackedTag, index - endTagLength, index);
|
6231
6422
|
}
|
6232
6423
|
|
6233
6424
|
if (html === last && options.chars) {
|
@@ -6273,10 +6464,10 @@ function parseHTML (html, options) {
|
|
6273
6464
|
|
6274
6465
|
if (expectHTML) {
|
6275
6466
|
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
6276
|
-
parseEndTag(
|
6467
|
+
parseEndTag(lastTag);
|
6277
6468
|
}
|
6278
6469
|
if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
|
6279
|
-
parseEndTag(
|
6470
|
+
parseEndTag(tagName);
|
6280
6471
|
}
|
6281
6472
|
}
|
6282
6473
|
|
@@ -6303,7 +6494,7 @@ function parseHTML (html, options) {
|
|
6303
6494
|
}
|
6304
6495
|
|
6305
6496
|
if (!unary) {
|
6306
|
-
stack.push({ tag: tagName, attrs: attrs });
|
6497
|
+
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
|
6307
6498
|
lastTag = tagName;
|
6308
6499
|
unarySlash = '';
|
6309
6500
|
}
|
@@ -6313,16 +6504,19 @@ function parseHTML (html, options) {
|
|
6313
6504
|
}
|
6314
6505
|
}
|
6315
6506
|
|
6316
|
-
function parseEndTag (
|
6317
|
-
var pos;
|
6507
|
+
function parseEndTag (tagName, start, end) {
|
6508
|
+
var pos, lowerCasedTagName;
|
6318
6509
|
if (start == null) { start = index; }
|
6319
6510
|
if (end == null) { end = index; }
|
6320
6511
|
|
6512
|
+
if (tagName) {
|
6513
|
+
lowerCasedTagName = tagName.toLowerCase();
|
6514
|
+
}
|
6515
|
+
|
6321
6516
|
// Find the closest opened tag of the same type
|
6322
6517
|
if (tagName) {
|
6323
|
-
var needle = tagName.toLowerCase();
|
6324
6518
|
for (pos = stack.length - 1; pos >= 0; pos--) {
|
6325
|
-
if (stack[pos].
|
6519
|
+
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
6326
6520
|
break
|
6327
6521
|
}
|
6328
6522
|
}
|
@@ -6342,11 +6536,11 @@ function parseHTML (html, options) {
|
|
6342
6536
|
// Remove the open elements from the stack
|
6343
6537
|
stack.length = pos;
|
6344
6538
|
lastTag = pos && stack[pos - 1].tag;
|
6345
|
-
} else if (
|
6539
|
+
} else if (lowerCasedTagName === 'br') {
|
6346
6540
|
if (options.start) {
|
6347
6541
|
options.start(tagName, [], true, start, end);
|
6348
6542
|
}
|
6349
|
-
} else if (
|
6543
|
+
} else if (lowerCasedTagName === 'p') {
|
6350
6544
|
if (options.start) {
|
6351
6545
|
options.start(tagName, [], false, start, end);
|
6352
6546
|
}
|
@@ -6456,7 +6650,7 @@ function wrapFilter (exp, filter) {
|
|
6456
6650
|
/* */
|
6457
6651
|
|
6458
6652
|
var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
|
6459
|
-
var regexEscapeRE = /[-.*+?^${}()|[\]
|
6653
|
+
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
6460
6654
|
|
6461
6655
|
var buildRegex = cached(function (delimiters) {
|
6462
6656
|
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
@@ -6758,7 +6952,7 @@ function parse (
|
|
6758
6952
|
"development" !== 'production' && warn$1(
|
6759
6953
|
'Templates should only be responsible for mapping the state to the ' +
|
6760
6954
|
'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
6761
|
-
"<" + tag + "
|
6955
|
+
"<" + tag + ">" + ', as they will not be parsed.'
|
6762
6956
|
);
|
6763
6957
|
}
|
6764
6958
|
|
@@ -6895,19 +7089,20 @@ function parse (
|
|
6895
7089
|
currentParent.attrsMap.placeholder === text) {
|
6896
7090
|
return
|
6897
7091
|
}
|
7092
|
+
var children = currentParent.children;
|
6898
7093
|
text = inPre || text.trim()
|
6899
7094
|
? decodeHTMLCached(text)
|
6900
7095
|
// only preserve whitespace if its not right after a starting tag
|
6901
|
-
: preserveWhitespace &&
|
7096
|
+
: preserveWhitespace && children.length ? ' ' : '';
|
6902
7097
|
if (text) {
|
6903
7098
|
var expression;
|
6904
7099
|
if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
|
6905
|
-
|
7100
|
+
children.push({
|
6906
7101
|
type: 2,
|
6907
7102
|
expression: expression,
|
6908
7103
|
text: text
|
6909
7104
|
});
|
6910
|
-
} else {
|
7105
|
+
} else if (text !== ' ' || children[children.length - 1].text !== ' ') {
|
6911
7106
|
currentParent.children.push({
|
6912
7107
|
type: 3,
|
6913
7108
|
text: text
|
@@ -7018,6 +7213,23 @@ function processIfConditions (el, parent) {
|
|
7018
7213
|
}
|
7019
7214
|
}
|
7020
7215
|
|
7216
|
+
function findPrevElement (children) {
|
7217
|
+
var i = children.length;
|
7218
|
+
while (i--) {
|
7219
|
+
if (children[i].type === 1) {
|
7220
|
+
return children[i]
|
7221
|
+
} else {
|
7222
|
+
if ("development" !== 'production' && children[i].text !== ' ') {
|
7223
|
+
warn$1(
|
7224
|
+
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
7225
|
+
"will be ignored."
|
7226
|
+
);
|
7227
|
+
}
|
7228
|
+
children.pop();
|
7229
|
+
}
|
7230
|
+
}
|
7231
|
+
}
|
7232
|
+
|
7021
7233
|
function addIfCondition (el, condition) {
|
7022
7234
|
if (!el.ifConditions) {
|
7023
7235
|
el.ifConditions = [];
|
@@ -7091,7 +7303,7 @@ function processAttrs (el) {
|
|
7091
7303
|
name = camelize(name);
|
7092
7304
|
}
|
7093
7305
|
}
|
7094
|
-
if (isProp || platformMustUseProp(el.tag, name)) {
|
7306
|
+
if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
7095
7307
|
addProp(el, name, value);
|
7096
7308
|
} else {
|
7097
7309
|
addAttr(el, name, value);
|
@@ -7160,13 +7372,6 @@ function makeAttrsMap (attrs) {
|
|
7160
7372
|
return map
|
7161
7373
|
}
|
7162
7374
|
|
7163
|
-
function findPrevElement (children) {
|
7164
|
-
var i = children.length;
|
7165
|
-
while (i--) {
|
7166
|
-
if (children[i].tag) { return children[i] }
|
7167
|
-
}
|
7168
|
-
}
|
7169
|
-
|
7170
7375
|
function isForbiddenTag (el) {
|
7171
7376
|
return (
|
7172
7377
|
el.tag === 'style' ||
|
@@ -7420,6 +7625,8 @@ function bind$2 (el, dir) {
|
|
7420
7625
|
};
|
7421
7626
|
}
|
7422
7627
|
|
7628
|
+
/* */
|
7629
|
+
|
7423
7630
|
var baseDirectives = {
|
7424
7631
|
bind: bind$2,
|
7425
7632
|
cloak: noop
|
@@ -7432,6 +7639,7 @@ var warn$2;
|
|
7432
7639
|
var transforms$1;
|
7433
7640
|
var dataGenFns;
|
7434
7641
|
var platformDirectives$1;
|
7642
|
+
var isPlatformReservedTag$1;
|
7435
7643
|
var staticRenderFns;
|
7436
7644
|
var onceCount;
|
7437
7645
|
var currentOptions;
|
@@ -7450,6 +7658,7 @@ function generate (
|
|
7450
7658
|
transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
|
7451
7659
|
dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
7452
7660
|
platformDirectives$1 = options.directives || {};
|
7661
|
+
isPlatformReservedTag$1 = options.isReservedTag || no;
|
7453
7662
|
var code = ast ? genElement(ast) : '_c("div")';
|
7454
7663
|
staticRenderFns = prevStaticRenderFns;
|
7455
7664
|
onceCount = prevOnceCount;
|
@@ -7689,25 +7898,43 @@ function genChildren (el, checkSkip) {
|
|
7689
7898
|
el$1.tag !== 'slot') {
|
7690
7899
|
return genElement(el$1)
|
7691
7900
|
}
|
7901
|
+
var normalizationType = getNormalizationType(children);
|
7692
7902
|
return ("[" + (children.map(genNode).join(',')) + "]" + (checkSkip
|
7693
|
-
?
|
7903
|
+
? normalizationType ? ("," + normalizationType) : ''
|
7694
7904
|
: ''))
|
7695
7905
|
}
|
7696
7906
|
}
|
7697
7907
|
|
7698
|
-
|
7908
|
+
// determine the normalization needed for the children array.
|
7909
|
+
// 0: no normalization needed
|
7910
|
+
// 1: simple normalization needed (possible 1-level deep nested array)
|
7911
|
+
// 2: full normalization needed
|
7912
|
+
function getNormalizationType (children) {
|
7913
|
+
var res = 0;
|
7699
7914
|
for (var i = 0; i < children.length; i++) {
|
7700
7915
|
var el = children[i];
|
7916
|
+
if (el.type !== 1) {
|
7917
|
+
continue
|
7918
|
+
}
|
7701
7919
|
if (needsNormalization(el) ||
|
7702
|
-
(el.
|
7703
|
-
|
7920
|
+
(el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
7921
|
+
res = 2;
|
7922
|
+
break
|
7923
|
+
}
|
7924
|
+
if (maybeComponent(el) ||
|
7925
|
+
(el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
7926
|
+
res = 1;
|
7704
7927
|
}
|
7705
7928
|
}
|
7706
|
-
return
|
7929
|
+
return res
|
7707
7930
|
}
|
7708
7931
|
|
7709
7932
|
function needsNormalization (el) {
|
7710
|
-
return el.for || el.tag === 'template' || el.tag === 'slot'
|
7933
|
+
return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
7934
|
+
}
|
7935
|
+
|
7936
|
+
function maybeComponent (el) {
|
7937
|
+
return !isPlatformReservedTag$1(el.tag)
|
7711
7938
|
}
|
7712
7939
|
|
7713
7940
|
function genNode (node) {
|
@@ -7727,7 +7954,19 @@ function genText (text) {
|
|
7727
7954
|
function genSlot (el) {
|
7728
7955
|
var slotName = el.slotName || '"default"';
|
7729
7956
|
var children = genChildren(el);
|
7730
|
-
|
7957
|
+
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
7958
|
+
var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
|
7959
|
+
var bind$$1 = el.attrsMap['v-bind'];
|
7960
|
+
if ((attrs || bind$$1) && !children) {
|
7961
|
+
res += ",null";
|
7962
|
+
}
|
7963
|
+
if (attrs) {
|
7964
|
+
res += "," + attrs;
|
7965
|
+
}
|
7966
|
+
if (bind$$1) {
|
7967
|
+
res += (attrs ? '' : ',null') + "," + bind$$1;
|
7968
|
+
}
|
7969
|
+
return res + ')'
|
7731
7970
|
}
|
7732
7971
|
|
7733
7972
|
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|
@@ -7992,10 +8231,13 @@ function genCheckboxModel (
|
|
7992
8231
|
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7993
8232
|
addProp(el, 'checked',
|
7994
8233
|
"Array.isArray(" + value + ")" +
|
7995
|
-
"?_i(" + value + "," + valueBinding + ")>-1" +
|
7996
|
-
|
8234
|
+
"?_i(" + value + "," + valueBinding + ")>-1" + (
|
8235
|
+
trueValueBinding === 'true'
|
8236
|
+
? (":(" + value + ")")
|
8237
|
+
: (":_q(" + value + "," + trueValueBinding + ")")
|
8238
|
+
)
|
7997
8239
|
);
|
7998
|
-
addHandler(el, '
|
8240
|
+
addHandler(el, 'click',
|
7999
8241
|
"var $$a=" + value + "," +
|
8000
8242
|
'$$el=$event.target,' +
|
8001
8243
|
"$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
@@ -8026,7 +8268,7 @@ function genRadioModel (
|
|
8026
8268
|
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
8027
8269
|
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
8028
8270
|
addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
8029
|
-
addHandler(el, '
|
8271
|
+
addHandler(el, 'click', genAssignmentCode(value, valueBinding), null, true);
|
8030
8272
|
}
|
8031
8273
|
|
8032
8274
|
function genDefaultModel (
|