企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```javascript import VueRouter from 'vue-router' import Vue from 'vue' const Home = () => import ('../components/Home'); const HomeMessage = () => import('../components/HomeMessage'); const HomeNews = () => import('../components/HomeNews'); const About = () => import ('../components/About'); const User = () => import ('../components/User'); Vue.use(VueRouter); const routes = [ { path: '/', redirect : '/Home' }, { path: '/Home', component: Home, meta:{ title: "主页" }, children : [ { path: '', redirect : 'HomeMessage' }, { path: 'HomeMessage', component: HomeMessage }, { path:'HomeNews', component : HomeNews } ] }, { path: '/About', component : About, meta:{ title: "关于" } }, { path: '/User/:use_id', component : User, meta:{ title: "用户" } }, ]; const router =new VueRouter({ routes, mode : 'history', linkActiveClass : 'active' }) ; router.beforeEach((to, from, next) => { // 导航守卫 beforeEach window.document.title = to.matched[0].meta.title; next() }); export default router ```