vuejs 路由器没有点击
vuejs Router is not clicking
- 主页导航栏在页面中间
- 在该段落中,有一个路由器 link 可以打开顶部有默认导航栏的完整站点。
- 默认导航栏没有问题。
问题是:主页> 路由器 link 上面写着阅读更多> 它没有打开关于组件。这是代码
index.js 路由器文件:
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from "../views/AboutView.vue"
import Contactus from '../Pages/ContactusForms.vue'
const routes = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
component: AboutView
},
{
path: '/contactus',
name: 'contactus',
component: Contactus
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
首页
<center>
<router-link to="/about" class="btn btn-outline-black mt-3">Read More</router-link>
</center>
您还需要在路由器视图组件中渲染活动组件。这不会自动发生。
<router-view></router-view>
- 主页导航栏在页面中间
- 在该段落中,有一个路由器 link 可以打开顶部有默认导航栏的完整站点。
- 默认导航栏没有问题。
问题是:主页> 路由器 link 上面写着阅读更多> 它没有打开关于组件。这是代码
index.js 路由器文件:
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from "../views/AboutView.vue"
import Contactus from '../Pages/ContactusForms.vue'
const routes = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
component: AboutView
},
{
path: '/contactus',
name: 'contactus',
component: Contactus
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
首页
<center>
<router-link to="/about" class="btn btn-outline-black mt-3">Read More</router-link>
</center>
您还需要在路由器视图组件中渲染活动组件。这不会自动发生。
<router-view></router-view>