# vue-ref

> use the callback to get a reference like react

Latest version **2.0.0** (published 2020-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-ref
pnpm add vue-ref
yarn add vue-ref
bun add vue-ref
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-04-09 |
| First published | 2018-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 100 |
| Maintainers | tangjinzhou |
| Keywords | vue, ref, v-ref, vue-ref |

## Links

- npm: https://www.npmjs.com/package/vue-ref
- Repository: https://github.com/tangjinzhou/vue-ref
- Issues: https://github.com/tangjinzhou/vue-ref/issues
- npm.io page: https://npm.io/package/vue-ref

## Recent versions

- 2.0.0 (latest) — 2020-04-09
- 1.0.6 — 2019-03-07
- 1.0.5 — 2019-03-03
- 1.0.4 — 2019-01-14
- 1.0.3 — 2018-12-06
- 1.0.2 — 2018-11-26
- 1.0.1 — 2018-11-15
- 1.0.0 — 2018-11-15

## README

# vue-ref
You can use the callback to get a reference like react.

[![NPM version](https://img.shields.io/npm/v/vue-ref.svg?style=flat)](https://npmjs.org/package/vue-ref) [![NPM downloads](http://img.shields.io/npm/dm/vue-ref.svg?style=flat)](https://npmjs.org/package/vue-ref)

```bash
$ npm install vue-ref --save
```

```js
import ref from 'vue-ref'
Vue.use(ref)
```

```html
<!-- 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.

---
_Source: https://npm.io/package/vue-ref · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
