From efce3dcfbac731196e565c01cfd895b92a365e28 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 2 Mar 2020 10:42:45 +0800 Subject: [PATCH] fix(v3): recursively remove element --- packages/uni-app-plus/dist/index.v3.js | 5 ++++- .../uni-app-plus/dist/service.runtime.esm.dev.js | 12 ++++++------ .../uni-app-plus/dist/service.runtime.esm.prod.js | 12 ++++++------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index 6fa6cab9..fd2ae5e1 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -10906,7 +10906,10 @@ var serviceContext = (function () { } } - function request$1 (args, callbackId) { + function request$1 (args, callbackId) { + if (args.method !== 'GET' && args.header['Content-Type'].indexOf('application/json') === 0 && isPlainObject(args.data)) { + args.data = JSON.stringify(args.data); + } const { requestTaskId } = invokeMethod('createRequestTask', args); diff --git a/packages/uni-app-plus/dist/service.runtime.esm.dev.js b/packages/uni-app-plus/dist/service.runtime.esm.dev.js index 3bcb408c..da90af3a 100644 --- a/packages/uni-app-plus/dist/service.runtime.esm.dev.js +++ b/packages/uni-app-plus/dist/service.runtime.esm.dev.js @@ -6070,8 +6070,7 @@ function createPatchFunction (backend) { function removeAndInvokeRemoveHook (vnode, rm) { if (isDef(rm) || isDef(vnode.data)) { - var i; - var children; + var i, children; var listeners = cbs.remove.length + 1; if (isDef(rm)) { // we have a recursively passed down rm callback @@ -6084,9 +6083,10 @@ function createPatchFunction (backend) { // recursively invoke hooks on child component root node if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { removeAndInvokeRemoveHook(i, rm); - } else if(isDef(children = vnode.children)) { - // service层获取不到componentInstance,暂用此方式递归 - for (var i = 0; i < children.length; i++) { + } else if (isDef(children = vnode.children)) { + // app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找) + // 暂时使用 vnode 的 children 递归 rm 掉子 elm + for (i = 0; i < children.length; i++) { if (children[i].tag) { removeAndInvokeRemoveHook(children[i]); } @@ -6787,7 +6787,7 @@ function updateDOMListeners (oldVnode, vnode) { var on = vnode.data.on || {}; var oldOn = oldVnode.data.on || {}; target$1 = vnode.elm; - + // fixed by xxxxxx 存储 vd target$1._$vd = vnode.context._$vd; var context = vnode.context; diff --git a/packages/uni-app-plus/dist/service.runtime.esm.prod.js b/packages/uni-app-plus/dist/service.runtime.esm.prod.js index e3ed94f6..e81f2f4b 100644 --- a/packages/uni-app-plus/dist/service.runtime.esm.prod.js +++ b/packages/uni-app-plus/dist/service.runtime.esm.prod.js @@ -5288,8 +5288,7 @@ function createPatchFunction (backend) { function removeAndInvokeRemoveHook (vnode, rm) { if (isDef(rm) || isDef(vnode.data)) { - var i; - var children; + var i, children; var listeners = cbs.remove.length + 1; if (isDef(rm)) { // we have a recursively passed down rm callback @@ -5302,9 +5301,10 @@ function createPatchFunction (backend) { // recursively invoke hooks on child component root node if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { removeAndInvokeRemoveHook(i, rm); - } else if(isDef(children = vnode.children)) { - // service层获取不到componentInstance,暂用此方式递归 - for (var i = 0; i < children.length; i++) { + } else if (isDef(children = vnode.children)) { + // app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找) + // 暂时使用 vnode 的 children 递归 rm 掉子 elm + for (i = 0; i < children.length; i++) { if (children[i].tag) { removeAndInvokeRemoveHook(children[i]); } @@ -5936,7 +5936,7 @@ function updateDOMListeners (oldVnode, vnode) { var on = vnode.data.on || {}; var oldOn = oldVnode.data.on || {}; target$1 = vnode.elm; - + // fixed by xxxxxx 存储 vd target$1._$vd = vnode.context._$vd; var context = vnode.context; -- GitLab