当前位置:首页 > 千层云服务器 > 正文

vue中页面跳转的方式有哪些

在vue中实现页面跳转的方式有:1.使用a标签跳转;2.使用this.$router.push()函数跳转;3.使用router-link标签跳转;

vue中页面跳转的方式有哪些

在vue中实现页面跳转的方式有以下几种

1.使用a标签跳转

<ahref="https://www.baidu.com"><button>点击跳转</button></a>

2.使用this.$router.push()函数跳转

<template>

<divid='test'>

<button@click='goTo()'>点击跳转</button>

</div>

</template>

<script>

exportdefault{

name:'test',

methods:{

goTo(){

this.$router.push('/testDemo');

3.使用router-link标签跳转

<router-link:to="{path:'testDemo',query:{setid:123456}}">

<button>点击跳转</button>

</router-link>


如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

在线客服