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

build uni-mp-toutiao

上级 14cfd5cd
...@@ -1376,21 +1376,45 @@ function isPage () { ...@@ -1376,21 +1376,45 @@ function isPage () {
function initRefs (vm) { function initRefs (vm) {
const mpInstance = vm.$scope; const mpInstance = vm.$scope;
mpInstance.selectAllComponents('.vue-ref', (components) => { /* eslint-disable no-undef */
components.forEach(component => { const minorVersion = parseInt(tt.getSystemInfoSync().SDKVersion.split('.')[1]);
const ref = component.dataset.ref; if (minorVersion > 16) {
vm.$refs[ref] = component.$vm || component; Object.defineProperty(vm, '$refs', {
}); get () {
}); const $refs = {};
mpInstance.selectAllComponents('.vue-ref-in-for', (forComponents) => { const components = mpInstance.selectAllComponents('.vue-ref');
forComponents.forEach(component => { components.forEach(component => {
const ref = component.dataset.ref; const ref = component.dataset.ref;
if (!vm.$refs[ref]) { $refs[ref] = component.$vm || component;
vm.$refs[ref] = []; });
const forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
forComponents.forEach(component => {
const ref = component.dataset.ref;
if (!$refs[ref]) {
$refs[ref] = [];
}
$refs[ref].push(component.$vm || component);
});
return $refs
} }
vm.$refs[ref].push(component.$vm || component);
}); });
}); } else {
mpInstance.selectAllComponents('.vue-ref', (components) => {
components.forEach(component => {
const ref = component.dataset.ref;
vm.$refs[ref] = component.$vm || component;
});
});
mpInstance.selectAllComponents('.vue-ref-in-for', (forComponents) => {
forComponents.forEach(component => {
const ref = component.dataset.ref;
if (!vm.$refs[ref]) {
vm.$refs[ref] = [];
}
vm.$refs[ref].push(component.$vm || component);
});
});
}
} }
const instances = Object.create(null); const instances = Object.create(null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册