vue - 页面跳转
HTML:a
小程序:navigator
Vue:router-link
1. router-link => a标签
2. javascript标签跳转页面
2.1
2.2
3. 常用方法之跳上一页/下一页
3.1
3.2
<template>
<div id="app">
<img src="./assets/logo.png">
<router-view/>
<router-link to="/">[跳转到主页]</router-link>
<router-link to="/login">[登录]</router-link>
<router-link to="/logout">[登出]</router-link> <!-- javascript跳转页面 -->
<button @click="goHome">[跳转到主页]</button> <!-- 回到上一页 -->
<button @click="upPage">[上一页]</button>
<button @click="downPage">[下一页]</button> <!-- 回到下一页 --> </div>
</template> <script>
export default {
name: "App",
methods: {
// 跳转页面方法
goHome() {
this.$router.push("/");
},
upPage() {
// 后退一步记录,等同于 history.back()
this.$router.go(-1);
},
downPage() {
// 在浏览器记录中前进一步,等同于 history.forward()
this.$router.go(1);
}
}
};
</script> <style lang='scss' type='text/css'>
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #f00;
margin-top: 60px;
img {
// width: 200px;
height: 100px;
}
}
</style>
vue - 页面跳转的更多相关文章
- Vue页面跳转动画效果实现
Vue页面跳转动画效果实现:https://juejin.im/post/5ba358a56fb9a05d2068401d
- vue页面跳转以及传参和取参
vue中this.$router.push()路由传值和获取的两种常见方法 1.路由传值 this.$router.push() (1) 想要导航到不同的URL,使用router.push()方法 ...
- VUE页面跳转方式
一.to +跳转路径 <router-link to="/">跳转到主页</router-link> <router-link :to="{ ...
- 生产环境,vue页面跳转的时候,js报404的问题
最近上线的一个vue项目,需要各种路由跳转,在开发和测试环境都没问题,但是在生产环境,发现后期更新代码的时候,有些机型(ios机型,暂未发现android有问题)跳转路由的时候,标题修改了,但是内容并 ...
- Vue页面跳转$router.push 的用法
vue2.0在使用的过程中, .vue文件之间的跳转,在template中的常见写法是: <router-link to="/miniCard/statement/horizon&qu ...
- vue 页面跳转传参
页面之间的跳转传参,正常前端js里写 window.location.href="xxxxx?id=1" 就可以了: 但是vue不一样 需要操作的是路由history,需要用到 V ...
- vue页面跳转拦截器
登录拦截逻辑 第一步:路由拦截 首先在定义路由的时候就需要多添加一个自定义字段requireAuth,用于判断该路由的访问是否需要登录.如果用户已经登录,则顺利进入路由, 否则就进入登录页面.在路由管 ...
- vue 页面跳转的两种方式
1,标签跳转 <router-link to='two'><button>点我到第二个页面</button></router-link> 2,点 ...
- vue:页面跳转和传参(页面之间,父传子,子传父)
1.返回上一个页面: A.<a @click="$router.back(-1)" class="btn">重新加载</a> B.thi ...
随机推荐
- EventBus机制 handler 区别
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 事件巴士 是 采用 观察者模式 实现 事件订阅总线, 可以用在 应用程序中, 组件之间, ...
- VS2015常用配置
一.调用控制台: 在VS中使用opencv或者QT过程中,完成编程后, 运行发现没有控制台窗口, 比如我们用Qt编写的界面软件, 又想看到我们在代码中添加的打印日志信息,这个时候加上控制台窗口就能实现 ...
- 如何解决The underlying provider failed on Open问题
转自codeproject,找了半天解决办法,这个最靠谱. 我数据库用的EF做ORM,在vs里面测试的时候不会出现这个错误,用IIS就出错了.解决方法如下 Solution for "The ...
- hdu 1569 最小割
和HDU 1565是一道题,只是数据加强了,貌似轮廓线DP来不了了. #include <cstdio> #include <cstring> #include <que ...
- SCOJ 4423: Necklace polya
4423: Necklace 题目连接: http://acm.scu.edu.cn/soj/problem.action?id=4423 Description baihacker bought a ...
- 直接拿来用!最火的iOS开源项目(一~三)
结束了GitHub平台上“最受欢迎的Android开源项目”系列盘点之后,我们正式迎来了“GitHub上最受欢迎的iOS开源项目”系列盘点.今天,我们将介绍20个在GitHub上非常受开发者欢迎的iO ...
- Changing the Output Voltage of a Switching Regulator on the Fly
http://www.powerguru.org/changing-the-output-voltage-of-a-switching-regulator-on-the-fly/ There are ...
- java多线程知识点汇总(四)多线程知识点脉络图
1.多线程安全问题 1)synchronized关键字:如何加锁的问题,选择synchronized方法还是synchnized代码块. 选择哪个锁问题,this对象,还是class对象(针对stat ...
- Shell学习:grep, sed, awk命令的练习题
http://www.cnblogs.com/chengmo/archive/2013/01/17/2865479.html 文件:datafileSteve Blenheim:238-923-736 ...
- 【属性动画示例】Property Animation
MainActivity 属性动画常用操作 // 可操控的属性有:alpha:x/y:scaleX/scaleY:rotation/rotationX/rotationY:transitionX/tr ...