2020-06-18 10:51:56 +00:00
|
|
|
const createRefHooks = fn => {
|
2020-06-10 10:21:16 +00:00
|
|
|
return {
|
2020-06-11 08:13:09 +00:00
|
|
|
onVnodeBeforeMount: vnode => {
|
2020-06-10 10:21:16 +00:00
|
|
|
fn(vnode.component || vnode.el, vnode.key);
|
|
|
|
},
|
|
|
|
onVnodeUpdated: vnode => {
|
|
|
|
fn(vnode.component || vnode.el, vnode.key);
|
|
|
|
},
|
2020-06-11 08:13:09 +00:00
|
|
|
onVnodeUnmounted: vnode => {
|
|
|
|
fn(null, vnode.key);
|
2020-06-10 10:21:16 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
2020-06-18 10:51:56 +00:00
|
|
|
export default createRefHooks;
|