首页
学习
活动
专区
圈层
工具
发布

06 配置首页

首先,创建src/views/index.vue作为首页。

首页

接着修改src/router/index.js,添加用于显示首页的路由。

import {

createRouter,

createWebHashHistory

} from "vue-router"

import IndexView from "@/views/index.vue"

// 路由列表

const routes = [

// 首页

{

path: "/",

component: IndexView,

}

]

// 路由器

const router = createRouter({

history: createWebHashHistory(),

routes,

})

// 导出

export default router;

最后,最重要的,要在src/App.vue中使用渲染路由指向的页面。

  • 发表于:
  • 原文链接https://page.om.qq.com/page/OoHZ4PlnvTmx1y2iti4L5FgA0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。
领券