How does the vuejs add the query and walk the object?
让这个老实返回的页面添加特殊路由,这个页面常常都是登录注册。这次我们根据登录举例。
省略
{
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?的更多相关文章
- 向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 ...
- js add media query
var msViewportStyle = document.createElement("style"); msViewportStyle.appendChild( docume ...
- [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 ...
- 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 ...
- 使用Query进行HQL语句查询和SQL语句查询
HQL的语法比较简单,与普通SQL的区别之处是针对对象的不同,在查询语句中将sql中的表名替换成了sql中的持久化类名,因为hibernate机制是基于对象进行查询的. 不带参数的查询,语句是“fro ...
- JPA Query in 集合
使用 :param的方式来传递参数,下面举个例子 @PersistenceContext EntityManager em @Override public List<Map> ...
- org.springframework.beans.MutablePropertyValues.add
最近在项目中,通过maven引入其他包时,启动报错如下: [ERROR][2016-10-08 14:01:20.716]Context initialization failed[org.sprin ...
- Hibernate 查询:HQL查询(Hibernate Query Languge)
HQL是一种面向对象的查询语言,其中没有表和字段的概念,只有类,对象和属性的概念. 使用HQL查询所有学生: public static void main(String[] args) { Sess ...
- 详解Office 外接程序 COM Add In的LoadBehavior及其妙用
Office的所有COM Add In,包括用Shared Add In模板和VSTO Add In模板创建的,都会在注表里面存储一些信息.对于当前用户安装的Add In,以Excel为例,对应的注册 ...
随机推荐
- 今天分享三种方法实现Linux系统调用,感兴趣的朋友可以参考一下
系统调用(System Call)是操作系统为在用户态运行的进程与硬件设备(如CPU.磁盘.打印机等)进行交互提供的一组接口.当用户进程需要发生系统调用时,CPU 通过软中断切换到内核态开始执行内核系 ...
- 业务线B/C端业务组件总结
/** * 业务线组件总结 * */ /* B端组件的总结 1.组件cssBase的总结 1像素底部边框 */ @mixin border - 1px - b($background: $gray - ...
- Objective-C中整数与字符串的相互转换
2013/4/15整理: 将整数转换成字符串 Convert Integer to NSString: 方法一: int Value = 112233; NSString *ValueString = ...
- 获取JSON格式的树形
需求:前端需要一个JSON格式的Tree,例如组织机构维护的时候使用到的,需要一次性返回给前端.所以编写了一个算是半通用的查询方法 1.数据库Dao层: /** * 根据父ID获取子数据 * @par ...
- anjular分页组件tm-pagination的使用
原组件地址:https://github.com/miaoyaoyao/AngularJs-UI (1)直接从git上clone下来的demo无法正常显示,后来重新到在线的demo上拷贝了templa ...
- 05解决flask循环引用的问题
1, 什么是循环引用问题?为什么会导致循环引用? 1.1先讲是什么? 主文件中class类过多会导致主文件冗余,如下图,所以我们单独给class类一个文件,然后再引用它. 1.2再讲为什么? 主文件为 ...
- Pandas 1 表格数据类型DataFrame
# -*- encoding:utf-8 -*- # Copyright (c) 2015 Shiye Inc. # All rights reserved. # # Author: ldq < ...
- android BLE Peripheral 模拟 ibeacon 发出ble 广播
Android对外模模式(peripheral)的支持: 从Android 5.0+开始才支持. api level >= 21 所以5.0 之前设备,是不能向外发送广播的. Android中心 ...
- C++进阶:新人易入的那些坑 --1.常量、常指针和指针常量
声明:以下内容B站/Youtube学习笔记,https://www.youtube.com/user/BoQianTheProgrammer/ Advanced C++. /* why use con ...
- JavaScript中实现小数点后保留2位
在项目中有时候会遇到要求输入的数字是整数或者小数点后绑定2位小数,因此可以用.toFixed(2)方法 下面是关于toFixed()方法的demo: <input type="numb ...