vue点击按钮跳转路由

记录开发中的一点笔记
Vue点击按钮跳转路由,如下

<template>
	<button @click="jumpTo">点击跳转</button>
<template>

<script>
	methods:{
		jumpTo(){
			//跳转到上一次浏览的页面
      		this.$router.go(-1)

      		//指定跳转的地址
      		this.$router.replace('/将要跳转的路由名称')

      		//指定跳转的路由的名字下
      		this.$router.replace({name:'指定路由名称'})

      		//通过push进行跳转
      		this.$router.push('/将要跳转的路由名称')
		}
	}
</script>

你可能感兴趣的:(vue.js,javascript,前端)