让这个老实返回的页面添加特殊路由,这个页面常常都是登录注册。这次我们根据登录举例。

省略
{
path:'/login?url=:url',
name:'loginfirst',
component:()=>import ('../views/login.vue')
},
{
path:'/login',
name:'loginsecond',
component:()=>import ('../views/login.vue')
}
省略

 我们在登录的按钮上这样搞。

获取这个页面的路由地址,只要一点这个按钮,url就会带上这个参数。

那怎么在这个登录页面获取url上的这个参数呢?Vue中有一个这样的对象query.我们可以通过devtool去观察一下这个对象

从而我们在登录的这个按钮中,通过query获取即可!

login(){
this.$store.dispatch('LOGIN',this.user).then(res=>{
console.log(res);
if (res){
if(this.$route.query.url!=null && this.$route.query.url!=undefined){
let returnurl = this.$route.query.url;
this.$router.push(returnurl);
return;
}else{
this.$router.push('/');
}
}
})
}

  

How does the vuejs add the query and walk the object?的更多相关文章

  1. 向json中添加新的熟悉或对象 Add new attribute (element) to JSON object using JavaScript

    How do I add new attribute (element) to JSON object using JavaScript? JSON stands for JavaScript Obj ...

  2. js add media query

    var msViewportStyle = document.createElement("style"); msViewportStyle.appendChild( docume ...

  3. [Ramda] Create a Query String from an Object using Ramda's toPairs function

    In this lesson, we'll use Ramda's toPairs function, along with map, join, concatand compose to creat ...

  4. Hibernate: Truly Understanding the Second-Level and Query Caches--reference

    I've written multiple articles here at Javalobby on the Hibernate O/R mapping tool, and they are usu ...

  5. 使用Query进行HQL语句查询和SQL语句查询

    HQL的语法比较简单,与普通SQL的区别之处是针对对象的不同,在查询语句中将sql中的表名替换成了sql中的持久化类名,因为hibernate机制是基于对象进行查询的. 不带参数的查询,语句是“fro ...

  6. JPA Query in 集合

    使用 :param的方式来传递参数,下面举个例子 @PersistenceContext ​​​​​​​EntityManager em @Override public List<Map> ...

  7. org.springframework.beans.MutablePropertyValues.add

    最近在项目中,通过maven引入其他包时,启动报错如下: [ERROR][2016-10-08 14:01:20.716]Context initialization failed[org.sprin ...

  8. Hibernate 查询:HQL查询(Hibernate Query Languge)

    HQL是一种面向对象的查询语言,其中没有表和字段的概念,只有类,对象和属性的概念. 使用HQL查询所有学生: public static void main(String[] args) { Sess ...

  9. 详解Office 外接程序 COM Add In的LoadBehavior及其妙用

    Office的所有COM Add In,包括用Shared Add In模板和VSTO Add In模板创建的,都会在注表里面存储一些信息.对于当前用户安装的Add In,以Excel为例,对应的注册 ...

随机推荐

  1. springboot引用dubbo的方式

    1.以此种接口依赖的方式 这种相当于将其他模块的服务先拿过来dubbo自己在本模块中进行注入,此时可以直接用Spring的@Autowired注解引用 ,这种情况下本模块的扫描dubbo是所引用的模块 ...

  2. 动态DP之全局平衡二叉树

    目录 前置知识 全局平衡二叉树 大致介绍 建图过程 修改过程 询问过程 时间复杂度的证明 板题 前置知识 在学习如何使用全局平衡二叉树之前,你首先要知道如何使用树链剖分解决动态DP问题.这里仅做一个简 ...

  3. [SCOI2015]小凸玩矩阵

    Description: 给你一个n*m的网格,每个格子有一个数字,每行每列只能选一个数字,问所选数字中第k大的数字的最小值是多少 Hint: \(n \le 250\) Solution: 显然是二 ...

  4. js实现八皇后,回溯法

    八皇后问题:将八个皇后摆在一张8*8的国际象棋棋盘上,使每个皇后都无法吃掉别的皇后,一共有多少种摆法? 两个皇后不能同时在同一行,同一列,和斜对角线的位置上,使用回溯法解决. 从第一行选个位置开始放棋 ...

  5. python学习相关知识点

    1.ndarray中,添加行或列:https://blog.csdn.net/lishuandao/article/details/52444288 2.numpy中ndarray数组拼接方法介绍:h ...

  6. tyflow雨滴在物体上滑落测试

    http://docs.tyflow.com/download/

  7. 用Group by分组后,取每组的前3条记录,怎么取?

    使用子查询进行查询 SELECT * FROM home_content a WHERE ( SELECT count(id) FROM home_content WHERE class_link = ...

  8. 【原创】XAF常用属性字段设置

    1.IP地址IPV4 [XafDisplayName()] [ModelDefault("EditMaskType", "RegEx")] [ModelDefa ...

  9. Best Cow Line---POJ 3617(贪心)

    FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competiti ...

  10. 使用jQuery.form库中ajaxSubmit提交表单时遇到的一些问题

    初入前端,网上找的很多资料都不够详细,导致遇到很多问题,现记录如下: 1.首先引入 <script src="~/Scripts/jquery-1.10.2.js">& ...