fix: refhooks

pull/2494/head
tanjinzhou 4 years ago
parent 6f903c3a75
commit 7661eafe9c

@ -1,10 +1,10 @@
const createRefHooks = fn => { const createRefHooks = fn => {
return { return {
onVnodeBeforeMount: vnode => { onVnodeBeforeMount: vnode => {
fn(vnode.component || vnode.el, vnode.key); fn((vnode.component && vnode.component.ctx) || vnode.el, vnode.key);
}, },
onVnodeUpdated: vnode => { onVnodeUpdated: vnode => {
fn(vnode.component || vnode.el, vnode.key); fn((vnode.component && vnode.component.ctx) || vnode.el, vnode.key);
}, },
onVnodeUnmounted: vnode => { onVnodeUnmounted: vnode => {
fn(null, vnode.key); fn(null, vnode.key);

@ -32,10 +32,10 @@ const Switch = {
}, },
methods: { methods: {
focus() { focus() {
this.refSwitchNode?.ctx?.focus(); this.refSwitchNode?.focus();
}, },
blur() { blur() {
this.refSwitchNode?.ctx?.blur(); this.refSwitchNode?.blur();
}, },
saveRef(c) { saveRef(c) {
this.refSwitchNode = c; this.refSwitchNode = c;

Loading…
Cancel
Save