Skip to content

Commit e43361a

Browse files
committed
publish: 1.0.20 for bugfix #1305
1 parent 60ef8c1 commit e43361a

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

packages/mpvue-template-compiler/build.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,11 +2958,14 @@ function defineReactive$$1 (
29582958
childOb = !shallow && observe(newVal, undefined, key);
29592959
dep.notify();
29602960

2961-
var ob = obj.__ob__;
2962-
if (!ob.__keyPath) {
2963-
def(ob, '__keyPath', {}, false);
2961+
if (!obj.__keyPath) {
2962+
def(obj, '__keyPath', {}, false);
2963+
}
2964+
obj.__keyPath[key] = true;
2965+
if (newVal instanceof Object && !(newVal instanceof Array)) {
2966+
// 标记是否是通过this.Obj = {} 赋值印发的改动,解决少更新问题#1305
2967+
def(newVal, '__newReference', true, false);
29642968
}
2965-
ob.__keyPath[key] = true;
29662969
}
29672970
});
29682971
}

packages/mpvue-template-compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mpvue-template-compiler",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"description": "mpvue template compiler for Vue",
55
"main": "index.js",
66
"repository": {

packages/mpvue/index.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -919,11 +919,14 @@ function defineReactive$$1 (
919919
childOb = !shallow && observe(newVal, undefined, key);
920920
dep.notify();
921921

922-
var ob = obj.__ob__;
923-
if (!ob.__keyPath) {
924-
def(ob, '__keyPath', {}, false);
922+
if (!obj.__keyPath) {
923+
def(obj, '__keyPath', {}, false);
924+
}
925+
obj.__keyPath[key] = true;
926+
if (newVal instanceof Object && !(newVal instanceof Array)) {
927+
// 标记是否是通过this.Obj = {} 赋值印发的改动,解决少更新问题#1305
928+
def(newVal, '__newReference', true, false);
925929
}
926-
ob.__keyPath[key] = true;
927930
}
928931
});
929932
}
@@ -4176,7 +4179,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
41764179
});
41774180

41784181
Vue$3.version = '2.4.1';
4179-
Vue$3.mpvueVersion = '1.0.13';
4182+
Vue$3.mpvueVersion = '1.0.20';
41804183

41814184
/* globals renderer */
41824185

@@ -5392,7 +5395,7 @@ function minifyDeepData (rootKey, originKey, vmData, data, _mpValueSet, vm) {
53925395
} else {
53935396
// Object
53945397
var _keyPathOnThis = {}; // 存储这层对象的keyPath
5395-
if (vmData.__keyPath) {
5398+
if (vmData.__keyPath && !vmData.__newReference) {
53965399
// 有更新列表 ,按照更新列表更新
53975400
_keyPathOnThis = vmData.__keyPath;
53985401
Object.keys(vmData).forEach(function (_key) {
@@ -5420,6 +5423,8 @@ function minifyDeepData (rootKey, originKey, vmData, data, _mpValueSet, vm) {
54205423
// 没有更新列表
54215424
compareAndSetDeepData(rootKey + '.' + originKey, vmData, vm, data);
54225425
}
5426+
// 标记是否是通过this.Obj = {} 赋值印发的改动,解决少更新问题#1305
5427+
vmData.__newReference = false;
54235428
}
54245429
} catch (e) {
54255430
console.log(e, rootKey, originKey, vmData, data);
@@ -5451,7 +5456,7 @@ function diffData (vm, data) {
54515456
// console.log(rootKey)
54525457

54535458
// 值类型变量不考虑优化,还是直接更新
5454-
var __keyPathOnThis = getDeepData(['__ob__', '__keyPath'], vmData) || getDeepData(['__ob__', '__keyPath'], vm) || {};
5459+
var __keyPathOnThis = vmData.__keyPath || vm.__keyPath || {};
54555460
delete vm.__keyPath;
54565461
delete vmData.__keyPath;
54575462
delete vmProps.__keyPath;

packages/mpvue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mpvue",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"description": "Vue Runtime for mini program",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)