给文字添加链接

<template>
<div>
<router-link to="">转向A页面</router-link>
<router-link to="">转向B页面</router-link>
</div>
</template>

index.js

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import First from '@/components/first'
import A from '@/components/A'
import B from '@/components/B'

Vue.use(Router)

export default new Router({
routes: [
{
path: '/',
name: 'First333',
component: First
},
{
path: '/a',
component: A
},
{
path: '/b',
component: B
}
]
})

first.vue

<template>
<div>
<router-link to="/a">C罗</router-link>
<router-link to="/b">梅西</router-link>
</div>
</template>

a.vue

<template>
<div>
<p>尤文图斯</p>
<p><router-link to = "/">返回</router-link></p>
</div>
</template>

b.vue

<template>
<div>
<p>巴塞罗那</p>
<p><router-link to = "/">返回</router-link></p>
</div>
</template>