vue-ref

use the callback to get a reference like react
914,598 100
Install
npm install vue-ref
Latest Version:2.0.0
License:MIT
Last Updated:Dec 15, 2023
Links: GitHub  ·  npm
Maintainer: tangjinzhou

vue-ref

You can use the callback to get a reference like react.

NPM version NPM downloads

$ npm install vue-ref --save
import ref from 'vue-ref'
Vue.use(ref)
<!-- vm.dom will be the DOM node -->
<p v-ref="c => this.dom = c">hello</p>

<!-- vm.child will be the child component instance -->
<child-component v-ref="c => this.child = c"></child-component>

<span v-for="n in 10" :key="n" v-ref="(c, key) => {...}">{{ n }} </span>
Property Description Type
v-ref a callback function function(dom | vnode, key)

In this callback function, you should not change any reactive data. Otherwise the render will enter an infinite loop.

Related Packages

vue-multi-ref

a vue v2 directive to bind the same ref for more than one element

1,517 12
@cran/lib.vue.ref

Vue Reactivity Extensions

1,216
unplugin-vue-component-ref

用于获取setup组件ref全部导出

329 11
vue-deepunref

Deeply un-reference Vue objects.

155,261 15

Version History

Version Released License
2.0.0 MIT
1.0.6 MIT
1.0.5 MIT
1.0.4 MIT
1.0.3 MIT