From 7661eafe9c2a6f94762f17a33061e00e428d89d7 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Tue, 23 Jun 2020 16:50:02 +0800 Subject: [PATCH] fix: refhooks --- components/_util/createRefHooks.js | 4 ++-- components/switch/index.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/_util/createRefHooks.js b/components/_util/createRefHooks.js index 5cb29af2a..1951a7df7 100644 --- a/components/_util/createRefHooks.js +++ b/components/_util/createRefHooks.js @@ -1,10 +1,10 @@ const createRefHooks = fn => { return { onVnodeBeforeMount: vnode => { - fn(vnode.component || vnode.el, vnode.key); + fn((vnode.component && vnode.component.ctx) || vnode.el, vnode.key); }, onVnodeUpdated: vnode => { - fn(vnode.component || vnode.el, vnode.key); + fn((vnode.component && vnode.component.ctx) || vnode.el, vnode.key); }, onVnodeUnmounted: vnode => { fn(null, vnode.key); diff --git a/components/switch/index.jsx b/components/switch/index.jsx index e4946b657..a0c298f50 100644 --- a/components/switch/index.jsx +++ b/components/switch/index.jsx @@ -32,10 +32,10 @@ const Switch = { }, methods: { focus() { - this.refSwitchNode?.ctx?.focus(); + this.refSwitchNode?.focus(); }, blur() { - this.refSwitchNode?.ctx?.blur(); + this.refSwitchNode?.blur(); }, saveRef(c) { this.refSwitchNode = c;