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

feat(runtime): uni-mp refs

上级 193a2c33
...@@ -402,16 +402,16 @@ function initRefs (vm) { ...@@ -402,16 +402,16 @@ function initRefs (vm) {
const $refs = Object.create(null); const $refs = Object.create(null);
const components = mpInstance.selectAllComponents('.__ref__'); const components = mpInstance.selectAllComponents('.__ref__');
components.forEach(component => { components.forEach(component => {
const id = component.id; const ref = component.dataset.ref;
$refs[id] = component.$vm; $refs[ref] = component.$vm;
}); });
const forComponents = mpInstance.selectAllComponents('.__ref-in-for__'); const forComponents = mpInstance.selectAllComponents('.__ref-in-for__');
forComponents.forEach(component => { forComponents.forEach(component => {
const id = component.id; const ref = component.dataset.ref;
if (!$refs[id]) { if (!$refs[ref]) {
$refs[id] = []; $refs[ref] = [];
} }
$refs[id].push(component.$vm); $refs[ref].push(component.$vm);
}); });
return $refs return $refs
} }
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "0.0.1", "version": "0.0.2",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -404,16 +404,16 @@ function initRefs (vm) { ...@@ -404,16 +404,16 @@ function initRefs (vm) {
const $refs = Object.create(null); const $refs = Object.create(null);
const components = mpInstance.selectAllComponents('.__ref__'); const components = mpInstance.selectAllComponents('.__ref__');
components.forEach(component => { components.forEach(component => {
const id = component.id; const ref = component.dataset.ref;
$refs[id] = component.$vm; $refs[ref] = component.$vm;
}); });
const forComponents = mpInstance.selectAllComponents('.__ref-in-for__'); const forComponents = mpInstance.selectAllComponents('.__ref-in-for__');
forComponents.forEach(component => { forComponents.forEach(component => {
const id = component.id; const ref = component.dataset.ref;
if (!$refs[id]) { if (!$refs[ref]) {
$refs[id] = []; $refs[ref] = [];
} }
$refs[id].push(component.$vm); $refs[ref].push(component.$vm);
}); });
return $refs return $refs
} }
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.7", "version": "0.0.8",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -147,16 +147,16 @@ export function initRefs (vm) { ...@@ -147,16 +147,16 @@ export function initRefs (vm) {
const $refs = Object.create(null) const $refs = Object.create(null)
const components = mpInstance.selectAllComponents('.__ref__') const components = mpInstance.selectAllComponents('.__ref__')
components.forEach(component => { components.forEach(component => {
const id = component.id const ref = component.dataset.ref
$refs[id] = component.$vm $refs[ref] = component.$vm
}) })
const forComponents = mpInstance.selectAllComponents('.__ref-in-for__') const forComponents = mpInstance.selectAllComponents('.__ref-in-for__')
forComponents.forEach(component => { forComponents.forEach(component => {
const id = component.id const ref = component.dataset.ref
if (!$refs[id]) { if (!$refs[ref]) {
$refs[id] = [] $refs[ref] = []
} }
$refs[id].push(component.$vm) $refs[ref].push(component.$vm)
}) })
return $refs return $refs
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册