1. vue-ref
use the callback to get a reference like react
vue-ref
Package: vue-ref
Created by: tangjinzhou
Last modified: Mon, 23 May 2022 18:09:25 GMT
Version: 2.0.0
License: MIT
Downloads: 81,434
Repository: https://github.com/tangjinzhou/vue-ref

Install

npm install vue-ref
yarn add vue-ref

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 POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin