|
|
@@ -270,7 +270,7 @@ var config = {
|
|
|
/**
|
|
|
* Whether to record perf
|
|
|
*/
|
|
|
- performance: process.env.NODE_ENV !== 'production',
|
|
|
+ performance: false,
|
|
|
|
|
|
/**
|
|
|
* Error handler for watcher errors
|
|
|
@@ -346,6 +346,48 @@ var config = {
|
|
|
_maxUpdateCount: 100
|
|
|
};
|
|
|
|
|
|
+/* */
|
|
|
+
|
|
|
+var emptyObject = Object.freeze({});
|
|
|
+
|
|
|
+/**
|
|
|
+ * Check if a string starts with $ or _
|
|
|
+ */
|
|
|
+function isReserved (str) {
|
|
|
+ var c = (str + '').charCodeAt(0);
|
|
|
+ return c === 0x24 || c === 0x5F
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Define a property.
|
|
|
+ */
|
|
|
+function def (obj, key, val, enumerable) {
|
|
|
+ Object.defineProperty(obj, key, {
|
|
|
+ value: val,
|
|
|
+ enumerable: !!enumerable,
|
|
|
+ writable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Parse simple path.
|
|
|
+ */
|
|
|
+var bailRE = /[^\w.$]/;
|
|
|
+function parsePath (path) {
|
|
|
+ if (bailRE.test(path)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var segments = path.split('.');
|
|
|
+ return function (obj) {
|
|
|
+ for (var i = 0; i < segments.length; i++) {
|
|
|
+ if (!obj) { return }
|
|
|
+ obj = obj[segments[i]];
|
|
|
+ }
|
|
|
+ return obj
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/* */
|
|
|
/* globals MutationObserver */
|
|
|
|
|
|
@@ -495,57 +537,6 @@ if (typeof Set !== 'undefined' && isNative(Set)) {
|
|
|
}());
|
|
|
}
|
|
|
|
|
|
-var perf;
|
|
|
-
|
|
|
-if (process.env.NODE_ENV !== 'production') {
|
|
|
- perf = inBrowser && window.performance;
|
|
|
- if (perf && (!perf.mark || !perf.measure)) {
|
|
|
- perf = undefined;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/* */
|
|
|
-
|
|
|
-var emptyObject = Object.freeze({});
|
|
|
-
|
|
|
-/**
|
|
|
- * Check if a string starts with $ or _
|
|
|
- */
|
|
|
-function isReserved (str) {
|
|
|
- var c = (str + '').charCodeAt(0);
|
|
|
- return c === 0x24 || c === 0x5F
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * Define a property.
|
|
|
- */
|
|
|
-function def (obj, key, val, enumerable) {
|
|
|
- Object.defineProperty(obj, key, {
|
|
|
- value: val,
|
|
|
- enumerable: !!enumerable,
|
|
|
- writable: true,
|
|
|
- configurable: true
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * Parse simple path.
|
|
|
- */
|
|
|
-var bailRE = /[^\w.$]/;
|
|
|
-function parsePath (path) {
|
|
|
- if (bailRE.test(path)) {
|
|
|
- return
|
|
|
- }
|
|
|
- var segments = path.split('.');
|
|
|
- return function (obj) {
|
|
|
- for (var i = 0; i < segments.length; i++) {
|
|
|
- if (!obj) { return }
|
|
|
- obj = obj[segments[i]];
|
|
|
- }
|
|
|
- return obj
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
var warn = noop;
|
|
|
var tip = noop;
|
|
|
var formatComponentName;
|
|
|
@@ -577,9 +568,11 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
if (vm.$root === vm) {
|
|
|
return '<Root>'
|
|
|
}
|
|
|
- var name = vm._isVue
|
|
|
- ? vm.$options.name || vm.$options._componentTag
|
|
|
- : vm.name;
|
|
|
+ var name = typeof vm === 'function' && vm.options
|
|
|
+ ? vm.options.name
|
|
|
+ : vm._isVue
|
|
|
+ ? vm.$options.name || vm.$options._componentTag
|
|
|
+ : vm.name;
|
|
|
|
|
|
var file = vm._isVue && vm.$options.__file;
|
|
|
if (!name && file) {
|
|
|
@@ -1525,6 +1518,29 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+var mark;
|
|
|
+var measure;
|
|
|
+
|
|
|
+if (process.env.NODE_ENV !== 'production') {
|
|
|
+ var perf = inBrowser && window.performance;
|
|
|
+ /* istanbul ignore if */
|
|
|
+ if (
|
|
|
+ perf &&
|
|
|
+ perf.mark &&
|
|
|
+ perf.measure &&
|
|
|
+ perf.clearMarks &&
|
|
|
+ perf.clearMeasures
|
|
|
+ ) {
|
|
|
+ mark = function (tag) { return perf.mark(tag); };
|
|
|
+ measure = function (name, startTag, endTag) {
|
|
|
+ perf.measure(name, startTag, endTag);
|
|
|
+ perf.clearMarks(startTag);
|
|
|
+ perf.clearMarks(endTag);
|
|
|
+ perf.clearMeasures(name);
|
|
|
+ };
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/* */
|
|
|
|
|
|
var VNode = function VNode (
|
|
|
@@ -2096,19 +2112,21 @@ function mountComponent (
|
|
|
|
|
|
var updateComponent;
|
|
|
/* istanbul ignore if */
|
|
|
- if (process.env.NODE_ENV !== 'production' && config.performance && perf) {
|
|
|
+ if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
|
|
updateComponent = function () {
|
|
|
var name = vm._name;
|
|
|
var startTag = "start " + name;
|
|
|
var endTag = "end " + name;
|
|
|
- perf.mark(startTag);
|
|
|
+
|
|
|
+ mark(startTag);
|
|
|
var vnode = vm._render();
|
|
|
- perf.mark(endTag);
|
|
|
- perf.measure((name + " render"), startTag, endTag);
|
|
|
- perf.mark(startTag);
|
|
|
+ mark(endTag);
|
|
|
+ measure((name + " render"), startTag, endTag);
|
|
|
+
|
|
|
+ mark(startTag);
|
|
|
vm._update(vnode, hydrating);
|
|
|
- perf.mark(endTag);
|
|
|
- perf.measure((name + " patch"), startTag, endTag);
|
|
|
+ mark(endTag);
|
|
|
+ measure((name + " patch"), startTag, endTag);
|
|
|
};
|
|
|
} else {
|
|
|
updateComponent = function () {
|
|
|
@@ -2850,8 +2868,63 @@ function stateMixin (Vue) {
|
|
|
|
|
|
/* */
|
|
|
|
|
|
-var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy };
|
|
|
-var hooksToMerge = Object.keys(hooks);
|
|
|
+// hooks to be invoked on component VNodes during patch
|
|
|
+var componentVNodeHooks = {
|
|
|
+ init: function init (
|
|
|
+ vnode,
|
|
|
+ hydrating,
|
|
|
+ parentElm,
|
|
|
+ refElm
|
|
|
+ ) {
|
|
|
+ if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
|
|
|
+ var child = vnode.componentInstance = createComponentInstanceForVnode(
|
|
|
+ vnode,
|
|
|
+ activeInstance,
|
|
|
+ parentElm,
|
|
|
+ refElm
|
|
|
+ );
|
|
|
+ child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
|
+ } else if (vnode.data.keepAlive) {
|
|
|
+ // kept-alive components, treat as a patch
|
|
|
+ var mountedNode = vnode; // work around flow
|
|
|
+ componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ prepatch: function prepatch (oldVnode, vnode) {
|
|
|
+ var options = vnode.componentOptions;
|
|
|
+ var child = vnode.componentInstance = oldVnode.componentInstance;
|
|
|
+ updateChildComponent(
|
|
|
+ child,
|
|
|
+ options.propsData, // updated props
|
|
|
+ options.listeners, // updated listeners
|
|
|
+ vnode, // new parent vnode
|
|
|
+ options.children // new children
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ insert: function insert (vnode) {
|
|
|
+ if (!vnode.componentInstance._isMounted) {
|
|
|
+ vnode.componentInstance._isMounted = true;
|
|
|
+ callHook(vnode.componentInstance, 'mounted');
|
|
|
+ }
|
|
|
+ if (vnode.data.keepAlive) {
|
|
|
+ activateChildComponent(vnode.componentInstance, true /* direct */);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ destroy: function destroy (vnode) {
|
|
|
+ if (!vnode.componentInstance._isDestroyed) {
|
|
|
+ if (!vnode.data.keepAlive) {
|
|
|
+ vnode.componentInstance.$destroy();
|
|
|
+ } else {
|
|
|
+ deactivateChildComponent(vnode.componentInstance, true /* direct */);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+var hooksToMerge = Object.keys(componentVNodeHooks);
|
|
|
|
|
|
function createComponent (
|
|
|
Ctor,
|
|
|
@@ -2999,62 +3072,6 @@ function createComponentInstanceForVnode (
|
|
|
return new vnodeComponentOptions.Ctor(options)
|
|
|
}
|
|
|
|
|
|
-function init (
|
|
|
- vnode,
|
|
|
- hydrating,
|
|
|
- parentElm,
|
|
|
- refElm
|
|
|
-) {
|
|
|
- if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
|
|
|
- var child = vnode.componentInstance = createComponentInstanceForVnode(
|
|
|
- vnode,
|
|
|
- activeInstance,
|
|
|
- parentElm,
|
|
|
- refElm
|
|
|
- );
|
|
|
- child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
|
- } else if (vnode.data.keepAlive) {
|
|
|
- // kept-alive components, treat as a patch
|
|
|
- var mountedNode = vnode; // work around flow
|
|
|
- prepatch(mountedNode, mountedNode);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function prepatch (
|
|
|
- oldVnode,
|
|
|
- vnode
|
|
|
-) {
|
|
|
- var options = vnode.componentOptions;
|
|
|
- var child = vnode.componentInstance = oldVnode.componentInstance;
|
|
|
- updateChildComponent(
|
|
|
- child,
|
|
|
- options.propsData, // updated props
|
|
|
- options.listeners, // updated listeners
|
|
|
- vnode, // new parent vnode
|
|
|
- options.children // new children
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
-function insert (vnode) {
|
|
|
- if (!vnode.componentInstance._isMounted) {
|
|
|
- vnode.componentInstance._isMounted = true;
|
|
|
- callHook(vnode.componentInstance, 'mounted');
|
|
|
- }
|
|
|
- if (vnode.data.keepAlive) {
|
|
|
- activateChildComponent(vnode.componentInstance, true /* direct */);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function destroy (vnode) {
|
|
|
- if (!vnode.componentInstance._isDestroyed) {
|
|
|
- if (!vnode.data.keepAlive) {
|
|
|
- vnode.componentInstance.$destroy();
|
|
|
- } else {
|
|
|
- deactivateChildComponent(vnode.componentInstance, true /* direct */);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
function resolveAsyncComponent (
|
|
|
factory,
|
|
|
baseCtor,
|
|
|
@@ -3118,6 +3135,21 @@ function extractProps (data, Ctor) {
|
|
|
if (attrs || props || domProps) {
|
|
|
for (var key in propOptions) {
|
|
|
var altKey = hyphenate(key);
|
|
|
+ if (process.env.NODE_ENV !== 'production') {
|
|
|
+ var keyInLowerCase = key.toLowerCase();
|
|
|
+ if (
|
|
|
+ key !== keyInLowerCase &&
|
|
|
+ attrs && attrs.hasOwnProperty(keyInLowerCase)
|
|
|
+ ) {
|
|
|
+ warn(
|
|
|
+ "Prop \"" + keyInLowerCase + "\" is not declared in component " +
|
|
|
+ (formatComponentName(Ctor)) + ". Note that HTML attributes are " +
|
|
|
+ "case-insensitive and camelCased props need to use their kebab-case " +
|
|
|
+ "equivalents when using in-DOM templates. You should probably use " +
|
|
|
+ "\"" + altKey + "\" instead of \"" + key + "\"."
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
checkProp(res, props, key, altKey, true) ||
|
|
|
checkProp(res, attrs, key, altKey) ||
|
|
|
checkProp(res, domProps, key, altKey);
|
|
|
@@ -3158,7 +3190,7 @@ function mergeHooks (data) {
|
|
|
for (var i = 0; i < hooksToMerge.length; i++) {
|
|
|
var key = hooksToMerge[i];
|
|
|
var fromParent = data.hook[key];
|
|
|
- var ours = hooks[key];
|
|
|
+ var ours = componentVNodeHooks[key];
|
|
|
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
|
|
}
|
|
|
}
|
|
|
@@ -3400,14 +3432,17 @@ function bindObjectProps (
|
|
|
if (Array.isArray(value)) {
|
|
|
value = toObject(value);
|
|
|
}
|
|
|
+ var hash;
|
|
|
for (var key in value) {
|
|
|
if (key === 'class' || key === 'style') {
|
|
|
- data[key] = value[key];
|
|
|
+ hash = data;
|
|
|
} else {
|
|
|
var type = data.attrs && data.attrs.type;
|
|
|
- var hash = asProp || config.mustUseProp(tag, type, key)
|
|
|
+ hash = asProp || config.mustUseProp(tag, type, key)
|
|
|
? data.domProps || (data.domProps = {})
|
|
|
: data.attrs || (data.attrs = {});
|
|
|
+ }
|
|
|
+ if (!(key in hash)) {
|
|
|
hash[key] = value[key];
|
|
|
}
|
|
|
}
|
|
|
@@ -3619,8 +3654,8 @@ var uid = 0;
|
|
|
function initMixin (Vue) {
|
|
|
Vue.prototype._init = function (options) {
|
|
|
/* istanbul ignore if */
|
|
|
- if (process.env.NODE_ENV !== 'production' && config.performance && perf) {
|
|
|
- perf.mark('init');
|
|
|
+ if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
|
|
+ mark('init');
|
|
|
}
|
|
|
|
|
|
var vm = this;
|
|
|
@@ -3659,10 +3694,10 @@ function initMixin (Vue) {
|
|
|
callHook(vm, 'created');
|
|
|
|
|
|
/* istanbul ignore if */
|
|
|
- if (process.env.NODE_ENV !== 'production' && config.performance && perf) {
|
|
|
+ if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
|
|
vm._name = formatComponentName(vm, false);
|
|
|
- perf.mark('init end');
|
|
|
- perf.measure(((vm._name) + " init"), 'init', 'init end');
|
|
|
+ mark('init end');
|
|
|
+ measure(((vm._name) + " init"), 'init', 'init end');
|
|
|
}
|
|
|
|
|
|
if (vm.$options.el) {
|
|
|
@@ -4074,7 +4109,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', {
|
|
|
get: isServerRendering
|
|
|
});
|
|
|
|
|
|
-Vue$2.version = '2.2.1';
|
|
|
+Vue$2.version = '2.2.3';
|
|
|
|
|
|
/* globals renderer */
|
|
|
// renderer is injected by weex factory wrapper
|
|
|
@@ -4232,7 +4267,7 @@ function registerRef (vnode, isRemoval) {
|
|
|
|
|
|
var emptyNode = new VNode('', {}, []);
|
|
|
|
|
|
-var hooks$1 = ['create', 'activate', 'update', 'remove', 'destroy'];
|
|
|
+var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
|
|
|
|
|
function isUndef (s) {
|
|
|
return s == null
|
|
|
@@ -4268,10 +4303,10 @@ function createPatchFunction (backend) {
|
|
|
var modules = backend.modules;
|
|
|
var nodeOps = backend.nodeOps;
|
|
|
|
|
|
- for (i = 0; i < hooks$1.length; ++i) {
|
|
|
- cbs[hooks$1[i]] = [];
|
|
|
+ for (i = 0; i < hooks.length; ++i) {
|
|
|
+ cbs[hooks[i]] = [];
|
|
|
for (j = 0; j < modules.length; ++j) {
|
|
|
- if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
|
|
|
+ if (modules[j][hooks[i]] !== undefined) { cbs[hooks[i]].push(modules[j][hooks[i]]); }
|
|
|
}
|
|
|
}
|
|
|
|