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为例,对应的注册 ...
随机推荐
- 八、OpenStack—Cinder组件安装
一.安装和配置控制器节点 1.先决条件 1)创建数据库 # mysql -u root -p 2)创建cinder数据库 MariaDB [(none)]> CREATE DATABASE ci ...
- Linux top命令的用法详细详解
首先介绍top中一些字段的含义: VIRT:virtual memory usage 虚拟内存1.进程“需要的”虚拟内存大小,包括进程使用的库.代码.数据等2.假如进程申请100m的内存,但实际只使用 ...
- PHP通过get方法获得form表单数据方法总结
下面给大家带来具体的代码示例: 1.form表单代码示例(表单get提交) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <head> <meta cha ...
- github错误:fatal: remote origin already exists.
原文链接:http://blog.csdn.net/dengjianqiang2011/article/details/9260435 如果输入$ Git remote add origin git@ ...
- 180815 Python自学成才001
1.为什么学习Python? Python:脚本语言,易入门,可移植. Python适用范围:web开发.自动化测试工具编写. 适用岗位:运维开发(运维).自动化测试(软件测试).Python开发(软 ...
- vue的父子组建之间的通信(-),基于props和$emit之间的传递
对于vue而言,以为其核心思想为前端组建化.所以组建之间的通信必不可少. 相信接触过Angularjs的童鞋都知道angularjs的控制器之间的通信机制. 1:父传子:官方的$broadcast() ...
- [bzoj1088]扫雷
额,这种水题我也不说什么了233 Description 相信大家都玩过扫雷的游戏.那是在一个n*m的矩阵里面有一些雷,要你根据一些信息找出雷来.万圣节到了,“余”人国流行起了一种简单的扫雷游戏,这个 ...
- LeetCode笔记:39. Combination Sum
题目描述 给定一个无重复的正整数数组 candidates 和一个正整数 target, 求所有和为 target 的 candidates 中数的组合中.其中相同数的不同顺序组合算做同一种组合,ca ...
- aarch64的架构:unrecognized command line option '-mfpu=neon'
不用添加这个'-mfpu=neon'的编译器选项了,因为这个架构下neon是默认启动的. 参考: https://lists.linaro.org/pipermail/linaro-toolchain ...
- Python基础之面向对象2(封装)
一.封装定义: 二.作用 三.私有成员: 1.基本概念及作用 2.__slots__手段私有成员: 3.@property属性手段私有成员: 四.基础示例代码 1.用方法封装变量 "&quo ...