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

fix(v3): diff style

上级 1903fdc6
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册