从S页面到C页面,C页面再返回S页面,要保证S页面没有刷新返回内第一页。
在跳转到C页面的router-link设置,页面跳转的时候携带当前页码。
//nowpage为S页面需要保持的参数
<router-link :to="{path: 'C页面router地址',query: {nowpage: nowpage}}" >
在C页面返回S页面的动作中:
判断有传递过来的page参数,就把参数在传回去;没有参数传过来就返回上一级
if(this,$router.query.nowpage){
this.$router.push({path: 'S页面路由地址',query: {nowpage: this.$router.query.nowpage}})
}else{
this,$router.go(-1)}
返回S页面,在初始的时候判断是否修改成跳转之前的page:
init(){
this.deliverInfor(typeof(this.$router.query.nowpage) !== 'undefined' ? parseInt(this.$router.query.nowpage : 1 ) ;
}