Skip to content

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

License

Notifications You must be signed in to change notification settings

vueComponent/vue-ref

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published