# vue-update

> provides extra hook for data-updating

Latest version **1.0.6** (published 2016-12-25) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.0.6 |
| Published | 2016-12-25 |
| First published | 2016-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vincent Xu |
| Maintainers | zerodark |
| Keywords | vue, data, update |

## Links

- npm: https://www.npmjs.com/package/vue-update
- Repository: https://github.com/ZeroDark1991/vue-update
- Homepage: https://github.com/ZeroDark1991/vue-update#readme
- Issues: https://github.com/ZeroDark1991/vue-update/issues
- npm.io page: https://npm.io/package/vue-update

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2016-12-25
- 1.0.5 — 2016-12-24
- 1.0.4 — 2016-12-23
- 1.0.3 — 2016-12-23
- 1.0.2 — 2016-11-28
- 1.0.1 — 2016-11-28

## README

# vue-update [![npm package](https://img.shields.io/npm/v/vue-update.svg)](https://www.npmjs.com/package/vue-update)  <a href="https://www.npmjs.com/package/vue-update"><img src="https://img.shields.io/npm/dt/vue-update.svg" alt="Downloads"></a>


> Requires Vuejs 2.0

> Must works with [vue-router](https://github.com/vuejs/vue-router)

You can use it to manually control whether data should be updated when route enters, or do some things else.

It can be helpful in some cases, especially in 'keep-alive' mode.

## Install
```
	$ npm install vue-update --save-dev
```
main.js:
```js
	import Vue from 'vue'
	import VueRouter from 'vue-router'
	import VueUpdate from 'vue-update'
	
	Vue.use(VueRouter)
	Vue.use(VueUpdate)
```

## usage
see /example
```
  $ npm install
  $ npm run dev
```

Use ``` this.$pushToUpdate('/foo') ``` to push a route path into the updateQueue.

In bar.vue:

```js
	// push the route which needs to update
	
	this.$pushToUpdate('/foo')
	
	// you can also pass the route name
	this.$pushToUpdate('foo')
```

Then when you navigate to a route the matches anyone in the updateQueue, the hook function ``` update(){} ``` in the target route will trigger.

In foo.vue:

```js
	export default {
      data(){
        return {
	        msg: ''
        }
      },
      update(){
        // do something
        this.msg = 'foo'
        // once triggerd, '/foo' will be removed from the list
      }		
	}
```

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