1.0.6 • Published 7 years ago

vue-update v1.0.6

Weekly downloads
29
License
MIT
Repository
github
Last release
7 years ago

vue-update npm package

Requires Vuejs 2.0

Must works with 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:

	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:

	// 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:

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

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago