qh-vue-router-then
v1.9.0
Published
基于原作者的修改,针对嵌套路由的处理,只处理最后一层组件然后resolve
Downloads
5
Readme
vue-router-then
this.$routerThen.push().then()
Promise the router request, then do anything you want .
example.vue
methods:{
clickSomeOne:function(){
this.$routerThen.push('/hello_world').then(vm=>{
console.log(vm);
});
},
}
v-model-link
v-model-link: add a eventListener of the element or component, to catch the input event in next router page.
App.vue
<template>
<keep-alive>
<router-view class="transit-view"></router-view>
</keep-alive>
</template>
example.vue
<template>
<div>
<input v-model-link="'/select_someone'" @input="inputOfModelLink"/>
<inputCustomer v-model="fee" v-model-link="'/select_fee'" />
<textarea v-model="price" v-model-link="'/select_price'" ></textarea>
</div>
</template>
<script>
methods:{
jumpToNextPage:function(value){
this.$routerThen.modelLink('/select_price',value=>{
this.inputOfModelLink(value);
});
},
}
</script>
select_someone.vue
<script>
methods:{
clickSomeOne:function(value){
this.$emit('input',value);
this.$router.go(-1);
},
}
</script>
INSTALL
npm install vue-router-then --save;
import Vue from 'vue'
import router from './router'
import routerThen from 'vue-router-then';
routerThen.initRouter(router)
Vue.use(routerThen)
DEVELOP
- Code on src/index.js
- Gulp it
- pull it to me on github.
npm install
gulp
- You need install gulp in your computer if you hasnot have it.
sudo npm install -g gulp
- publish the code to npm if you want to do it.
npm config set registry=http://registry.npmjs.org
npm publish
License
MIT