<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>编程式路由的实现</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router/dist/vue-router.js"></script>
</head>
<body>
<div id="app">
<div>
<button type="button" @click="fun1()">跳转1</button>
</div>
<div>
<button type="button" @click="fun2()">跳转2</button>
</div>
<div>
<button type="button" @click="fun3()">跳转3</button>
</div>
<router-view></router-view>
</div>
<script>
//定义路由项
const router = new VueRouter({//路由对象,实例的定义
routes:[//定义路由项
{
path:'index/:id
vue13--编程式路由的实现
最新推荐文章于 2022-11-27 09:04:15 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)