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

build:runtime

上级 b794d41e
...@@ -1211,12 +1211,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; ...@@ -1211,12 +1211,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
function findVmByVueId (vm, vuePid) { function findVmByVueId (vm, vuePid) {
const $children = vm.$children; const $children = vm.$children;
// 优先查找直属 // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); for (let i = $children.length - 1; i >= 0; i--) {
if (parentVm) { const childVm = $children[i];
return parentVm if (childVm.$scope._$vueId === vuePid) {
return childVm
}
} }
// 反向递归查找 // 反向递归查找
let parentVm;
for (let i = $children.length - 1; i >= 0; i--) { for (let i = $children.length - 1; i >= 0; i--) {
parentVm = findVmByVueId($children[i], vuePid); parentVm = findVmByVueId($children[i], vuePid);
if (parentVm) { if (parentVm) {
......
...@@ -1643,12 +1643,15 @@ function parseBaseApp (vm, { ...@@ -1643,12 +1643,15 @@ function parseBaseApp (vm, {
function findVmByVueId (vm, vuePid) { function findVmByVueId (vm, vuePid) {
const $children = vm.$children; const $children = vm.$children;
// 优先查找直属 // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); for (let i = $children.length - 1; i >= 0; i--) {
if (parentVm) { const childVm = $children[i];
return parentVm if (childVm.$scope._$vueId === vuePid) {
return childVm
}
} }
// 反向递归查找 // 反向递归查找
let parentVm;
for (let i = $children.length - 1; i >= 0; i--) { for (let i = $children.length - 1; i >= 0; i--) {
parentVm = findVmByVueId($children[i], vuePid); parentVm = findVmByVueId($children[i], vuePid);
if (parentVm) { if (parentVm) {
......
...@@ -1347,12 +1347,15 @@ function parseBaseApp (vm, { ...@@ -1347,12 +1347,15 @@ function parseBaseApp (vm, {
function findVmByVueId (vm, vuePid) { function findVmByVueId (vm, vuePid) {
const $children = vm.$children; const $children = vm.$children;
// 优先查找直属 // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); for (let i = $children.length - 1; i >= 0; i--) {
if (parentVm) { const childVm = $children[i];
return parentVm if (childVm.$scope._$vueId === vuePid) {
return childVm
}
} }
// 反向递归查找 // 反向递归查找
let parentVm;
for (let i = $children.length - 1; i >= 0; i--) { for (let i = $children.length - 1; i >= 0; i--) {
parentVm = findVmByVueId($children[i], vuePid); parentVm = findVmByVueId($children[i], vuePid);
if (parentVm) { if (parentVm) {
......
...@@ -1271,12 +1271,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; ...@@ -1271,12 +1271,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
function findVmByVueId (vm, vuePid) { function findVmByVueId (vm, vuePid) {
const $children = vm.$children; const $children = vm.$children;
// 优先查找直属 // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); for (let i = $children.length - 1; i >= 0; i--) {
if (parentVm) { const childVm = $children[i];
return parentVm if (childVm.$scope._$vueId === vuePid) {
return childVm
}
} }
// 反向递归查找 // 反向递归查找
let parentVm;
for (let i = $children.length - 1; i >= 0; i--) { for (let i = $children.length - 1; i >= 0; i--) {
parentVm = findVmByVueId($children[i], vuePid); parentVm = findVmByVueId($children[i], vuePid);
if (parentVm) { if (parentVm) {
......
...@@ -1356,12 +1356,15 @@ function parseBaseApp (vm, { ...@@ -1356,12 +1356,15 @@ function parseBaseApp (vm, {
function findVmByVueId (vm, vuePid) { function findVmByVueId (vm, vuePid) {
const $children = vm.$children; const $children = vm.$children;
// 优先查找直属 // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); for (let i = $children.length - 1; i >= 0; i--) {
if (parentVm) { const childVm = $children[i];
return parentVm if (childVm.$scope._$vueId === vuePid) {
return childVm
}
} }
// 反向递归查找 // 反向递归查找
let parentVm;
for (let i = $children.length - 1; i >= 0; i--) { for (let i = $children.length - 1; i >= 0; i--) {
parentVm = findVmByVueId($children[i], vuePid); parentVm = findVmByVueId($children[i], vuePid);
if (parentVm) { if (parentVm) {
......
...@@ -1211,12 +1211,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; ...@@ -1211,12 +1211,15 @@ const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
function findVmByVueId (vm, vuePid) { function findVmByVueId (vm, vuePid) {
const $children = vm.$children; const $children = vm.$children;
// 优先查找直属 // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
let parentVm = $children.find(childVm => childVm.$scope._$vueId === vuePid); for (let i = $children.length - 1; i >= 0; i--) {
if (parentVm) { const childVm = $children[i];
return parentVm if (childVm.$scope._$vueId === vuePid) {
return childVm
}
} }
// 反向递归查找 // 反向递归查找
let parentVm;
for (let i = $children.length - 1; i >= 0; i--) { for (let i = $children.length - 1; i >= 0; i--) {
parentVm = findVmByVueId($children[i], vuePid); parentVm = findVmByVueId($children[i], vuePid);
if (parentVm) { if (parentVm) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册