diff --git a/Documents/HBuilderProjects/xm/src/router.js b/Documents/HBuilderProjects/xm/src/router.js index 9a5c942..4327d15 100644 --- a/Documents/HBuilderProjects/xm/src/router.js +++ b/Documents/HBuilderProjects/xm/src/router.js @@ -2,6 +2,9 @@ import { createRouter, createWebHistory } from 'vue-router' import Home from './views/Home.vue' import ArticleDetail from './components/ArticleDetail.vue'; // 假设你有一个显示文章详情的组件 import UserInfo from './views/UserAccount.vue'; +import UserDetail from './views/UserDetail.vue'; + + const routes = [ { path: '/', component: Home }, { @@ -14,7 +17,12 @@ const routes = [ path: '/userinfo', name: 'UserInfo', component: UserInfo, - }, + }, + { + path: '/user/:id', + name: 'UserDetail', + component: UserDetail + } ] const router = createRouter({ diff --git a/Documents/HBuilderProjects/xm/src/views/UserAccount.vue b/Documents/HBuilderProjects/xm/src/views/UserAccount.vue index aa16909..708c492 100644 --- a/Documents/HBuilderProjects/xm/src/views/UserAccount.vue +++ b/Documents/HBuilderProjects/xm/src/views/UserAccount.vue @@ -1,6 +1,7 @@