提交 b2895a5a 编写于 作者: D DCloud_LXH

fix(mp): patch diffData

上级 7a0d273a
......@@ -5420,6 +5420,8 @@ Vue.version = '2.6.11';
*/
var ARRAYTYPE = '[object Array]';
var OBJECTTYPE = '[object Object]';
var NULLTYPE = '[object Null]';
var UNDEFINEDTYPE = '[object Undefined]';
// const FUNCTIONTYPE = '[object Function]'
function diff(current, pre) {
......@@ -5453,6 +5455,16 @@ function syncKeys(current, pre) {
}
}
function nullOrUndefined(currentType, preType) {
if(
(currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
(preType === NULLTYPE || preType === UNDEFINEDTYPE)
) {
return false
}
return true
}
function _diff(current, pre, path, result) {
if (current === pre) { return }
var rootCurrentType = type(current);
......@@ -5467,7 +5479,7 @@ function _diff(current, pre, path, result) {
var currentType = type(currentValue);
var preType = type(preValue);
if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
if (currentValue !== pre[key]) {
if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
}
} else if (currentType == ARRAYTYPE) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册