Skip to content

Commit f21ee4d

Browse files
authored
Merge pull request #1374 from Meituan-Dianping/feature/ttalipay
Feature/ttalipay
2 parents e43361a + c4ec2fe commit f21ee4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1901
-1124
lines changed

dist/vue.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Vue.js v2.4.1
3-
* (c) 2014-2018 Evan You
3+
* (c) 2014-2019 Evan You
44
* Released under the MIT License.
55
*/
66
(function (global, factory) {
@@ -840,10 +840,13 @@ var observerState = {
840840
* object's property keys into getter/setters that
841841
* collect dependencies and dispatches updates.
842842
*/
843-
var Observer = function Observer (value) {
843+
var Observer = function Observer (value, key) {
844844
this.value = value;
845845
this.dep = new Dep();
846846
this.vmCount = 0;
847+
if (key) {
848+
this.key = key;
849+
}
847850
def(value, '__ob__', this);
848851
if (Array.isArray(value)) {
849852
var augment = hasProto
@@ -906,7 +909,7 @@ function copyAugment (target, src, keys) {
906909
* returns the new observer if successfully observed,
907910
* or the existing observer if the value already has one.
908911
*/
909-
function observe (value, asRootData) {
912+
function observe (value, asRootData, key) {
910913
if (!isObject(value)) {
911914
return
912915
}
@@ -920,7 +923,9 @@ function observe (value, asRootData) {
920923
Object.isExtensible(value) &&
921924
!value._isVue
922925
) {
923-
ob = new Observer(value);
926+
ob = new Observer(value, key);
927+
ob.__keyPath = ob.__keyPath ? ob.__keyPath : {};
928+
ob.__keyPath[key] = true;
924929
}
925930
if (asRootData && ob) {
926931
ob.vmCount++;
@@ -949,7 +954,7 @@ function defineReactive$$1 (
949954
var getter = property && property.get;
950955
var setter = property && property.set;
951956

952-
var childOb = !shallow && observe(val);
957+
var childOb = !shallow && observe(val, undefined, key);
953958
Object.defineProperty(obj, key, {
954959
enumerable: true,
955960
configurable: true,
@@ -972,6 +977,7 @@ function defineReactive$$1 (
972977
if (newVal === value || (newVal !== newVal && value !== value)) {
973978
return
974979
}
980+
975981
/* eslint-enable no-self-compare */
976982
if ("development" !== 'production' && customSetter) {
977983
customSetter();
@@ -981,8 +987,10 @@ function defineReactive$$1 (
981987
} else {
982988
val = newVal;
983989
}
984-
childOb = !shallow && observe(newVal);
990+
childOb = !shallow && observe(newVal, undefined, key);
985991
dep.notify();
992+
obj.__keyPath = obj.__keyPath ? obj.__keyPath : {};
993+
obj.__keyPath[key] = true;
986994
}
987995
});
988996
}
@@ -1015,6 +1023,11 @@ function set (target, key, val) {
10151023
return val
10161024
}
10171025
defineReactive$$1(ob.value, key, val);
1026+
// Vue.set 添加对象属性,渲染时候把 val 传给小程序渲染
1027+
if (!target.__keyPath) {
1028+
target.__keyPath = {};
1029+
}
1030+
target.__keyPath[key] = true;
10181031
ob.dep.notify();
10191032
return val
10201033
}
@@ -1042,6 +1055,11 @@ function del (target, key) {
10421055
if (!ob) {
10431056
return
10441057
}
1058+
if (!target.__keyPath) {
1059+
target.__keyPath = {};
1060+
}
1061+
// Vue.del 删除对象属性,渲染时候把这个属性设置为 undefined
1062+
target.__keyPath[key] = 'del';
10451063
ob.dep.notify();
10461064
}
10471065

@@ -4618,7 +4636,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
46184636
});
46194637

46204638
Vue$3.version = '2.4.1';
4621-
Vue$3.mpvueVersion = '1.0.11';
4639+
Vue$3.mpvueVersion = '1.0.13';
46224640

46234641
/* */
46244642

0 commit comments

Comments
 (0)