Linux 拨号vps windows公众号手机端

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

lewis 6年前 (2019-03-28) 阅读数 10 #程序编程
文章标签 vue页面跳转

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

在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>


版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

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

热门