diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 480200986ef53d3e1c40f51f8f262823d2dda6fd..69ec399a8a2531c8bb6d1f3664ff826c982d971f 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1211,12 +1211,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; function findVmByVueId (vm, vuePid) { const $children = vm.$children; - // 优先查找直属 - let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); - if (parentVm) { - return parentVm + // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + for (let i = $children.length - 1; i >= 0; i--) { + const childVm = $children[i]; + if (childVm.$scope._$vueId === vuePid) { + return childVm + } } // 反向递归查找 + let parentVm; for (let i = $children.length - 1; i >= 0; i--) { parentVm = findVmByVueId($children[i], vuePid); if (parentVm) { diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 8e18e39b60ce6af940dba61c2c9112b333597eea..cb227d7b74b6d6679e604d0dcc103dd0e08143c8 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -1643,12 +1643,15 @@ function parseBaseApp (vm, { function findVmByVueId (vm, vuePid) { const $children = vm.$children; - // 优先查找直属 - let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); - if (parentVm) { - return parentVm + // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + for (let i = $children.length - 1; i >= 0; i--) { + const childVm = $children[i]; + if (childVm.$scope._$vueId === vuePid) { + return childVm + } } // 反向递归查找 + let parentVm; for (let i = $children.length - 1; i >= 0; i--) { parentVm = findVmByVueId($children[i], vuePid); if (parentVm) { diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index bf79c194b5a4517cbe360cfd3559e06976dcc703..0bbf148614f7d8ad8133e46770e9ae350e28da41 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1347,12 +1347,15 @@ function parseBaseApp (vm, { function findVmByVueId (vm, vuePid) { const $children = vm.$children; - // 优先查找直属 - let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); - if (parentVm) { - return parentVm + // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + for (let i = $children.length - 1; i >= 0; i--) { + const childVm = $children[i]; + if (childVm.$scope._$vueId === vuePid) { + return childVm + } } // 反向递归查找 + let parentVm; for (let i = $children.length - 1; i >= 0; i--) { parentVm = findVmByVueId($children[i], vuePid); if (parentVm) { diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 2cba707f7d1000a63aa14007d486567ee4ee613e..fcdf9022e75551193b477d9651bc199db2176421 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1271,12 +1271,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; function findVmByVueId (vm, vuePid) { const $children = vm.$children; - // 优先查找直属 - let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); - if (parentVm) { - return parentVm + // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + for (let i = $children.length - 1; i >= 0; i--) { + const childVm = $children[i]; + if (childVm.$scope._$vueId === vuePid) { + return childVm + } } // 反向递归查找 + let parentVm; for (let i = $children.length - 1; i >= 0; i--) { parentVm = findVmByVueId($children[i], vuePid); if (parentVm) { diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 4c738a88d2fccb17497eff013b27b700412c6316..40fc9dfee395219ec3eb425142084cd3e220e305 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1356,12 +1356,15 @@ function parseBaseApp (vm, { function findVmByVueId (vm, vuePid) { const $children = vm.$children; - // 优先查找直属 - let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); - if (parentVm) { - return parentVm + // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + for (let i = $children.length - 1; i >= 0; i--) { + const childVm = $children[i]; + if (childVm.$scope._$vueId === vuePid) { + return childVm + } } // 反向递归查找 + let parentVm; for (let i = $children.length - 1; i >= 0; i--) { parentVm = findVmByVueId($children[i], vuePid); if (parentVm) { diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 5463b4f5dea7d3d8e01e6716e08532c8fde91825..acfc0194a517d2f7a002844f011637a920f75cd7 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1211,12 +1211,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; function findVmByVueId (vm, vuePid) { const $children = vm.$children; - // 优先查找直属 - let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); - if (parentVm) { - return parentVm + // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200) + for (let i = $children.length - 1; i >= 0; i--) { + const childVm = $children[i]; + if (childVm.$scope._$vueId === vuePid) { + return childVm + } } // 反向递归查找 + let parentVm; for (let i = $children.length - 1; i >= 0; i--) { parentVm = findVmByVueId($children[i], vuePid); if (parentVm) {