From cc29d0ae2acf945bdd8a7ede8e2f15ea12c0c9fd Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 6 Dec 2019 20:02:22 +0800 Subject: [PATCH] fix(v3): diff style --- packages/uni-app-plus/dist/index.v3.js | 10 ++++++---- .../app-plus/service/framework/plugins/diff.js | 13 +++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index ef0a677da..dbc259497 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -12181,10 +12181,12 @@ var serviceContext = (function () { cur = newObj[key]; old = oldObj[key]; if (old !== cur) { - if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) { - const style = diffObject(cur, old); - style && setResult(result || (result = Object.create(null)), B_STYLE, style); - } else if (key === V_FOR && Array.isArray(cur) && Array.isArray(old)) { + // 全量同步 style (因为 style 可能会动态删除部分样式) + // if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) { + // const style = diffObject(cur, old) + // style && setResult(result || (result = Object.create(null)), B_STYLE, style) + // } else + if (key === V_FOR && Array.isArray(cur) && Array.isArray(old)) { const vFor = diffArray(cur, old); vFor && setResult(result || (result = Object.create(null)), V_FOR, vFor); } else { diff --git a/src/platforms/app-plus/service/framework/plugins/diff.js b/src/platforms/app-plus/service/framework/plugins/diff.js index 152315927..95a080fac 100644 --- a/src/platforms/app-plus/service/framework/plugins/diff.js +++ b/src/platforms/app-plus/service/framework/plugins/diff.js @@ -3,8 +3,7 @@ import { } from 'uni-shared' import { - V_FOR, - B_STYLE + V_FOR } from '../../constants' function setResult (data, k, v) { @@ -52,10 +51,12 @@ function diffElmData (newObj, oldObj) { cur = newObj[key] old = oldObj[key] if (old !== cur) { - if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) { - const style = diffObject(cur, old) - style && setResult(result || (result = Object.create(null)), B_STYLE, style) - } else if (key === V_FOR && Array.isArray(cur) && Array.isArray(old)) { + // 全量同步 style (因为 style 可能会动态删除部分样式) + // if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) { + // const style = diffObject(cur, old) + // style && setResult(result || (result = Object.create(null)), B_STYLE, style) + // } else + if (key === V_FOR && Array.isArray(cur) && Array.isArray(old)) { const vFor = diffArray(cur, old) vFor && setResult(result || (result = Object.create(null)), V_FOR, vFor) } else { -- GitLab