提交 cc29d0ae 编写于 作者: fxy060608's avatar fxy060608

fix(v3): diff style

上级 1903fdc6
...@@ -12181,10 +12181,12 @@ var serviceContext = (function () { ...@@ -12181,10 +12181,12 @@ var serviceContext = (function () {
cur = newObj[key]; cur = newObj[key];
old = oldObj[key]; old = oldObj[key];
if (old !== cur) { if (old !== cur) {
if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) { // 全量同步 style (因为 style 可能会动态删除部分样式)
const style = diffObject(cur, old); // if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) {
style && setResult(result || (result = Object.create(null)), B_STYLE, style); // const style = diffObject(cur, old)
} else if (key === V_FOR && Array.isArray(cur) && Array.isArray(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); const vFor = diffArray(cur, old);
vFor && setResult(result || (result = Object.create(null)), V_FOR, vFor); vFor && setResult(result || (result = Object.create(null)), V_FOR, vFor);
} else { } else {
......
...@@ -3,8 +3,7 @@ import { ...@@ -3,8 +3,7 @@ import {
} from 'uni-shared' } from 'uni-shared'
import { import {
V_FOR, V_FOR
B_STYLE
} from '../../constants' } from '../../constants'
function setResult (data, k, v) { function setResult (data, k, v) {
...@@ -52,10 +51,12 @@ function diffElmData (newObj, oldObj) { ...@@ -52,10 +51,12 @@ function diffElmData (newObj, oldObj) {
cur = newObj[key] cur = newObj[key]
old = oldObj[key] old = oldObj[key]
if (old !== cur) { if (old !== cur) {
if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) { // 全量同步 style (因为 style 可能会动态删除部分样式)
const style = diffObject(cur, old) // if (key === B_STYLE && isPlainObject(cur) && isPlainObject(old)) {
style && setResult(result || (result = Object.create(null)), B_STYLE, style) // const style = diffObject(cur, old)
} else if (key === V_FOR && Array.isArray(cur) && Array.isArray(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) const vFor = diffArray(cur, old)
vFor && setResult(result || (result = Object.create(null)), V_FOR, vFor) vFor && setResult(result || (result = Object.create(null)), V_FOR, vFor)
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册