vue3路由router跳转

router.js 里面写,只写了核心部分,其他部分百度参考下

const routes = [
    {
		path: '/home',
		component: Home,
		children: [
			{
				path: 'aaa',
				name: 'aaa',
				component: () => import('@/views/aaa/aaa.vue'),
				meta: {
					title: 'aaa信息',
				},
			},
			{
				path: 'bbb',
				name: 'bbb',
				component: () => import('@/views/bbb/bbb.vue'),
				meta: {
					title: 'bbb信息',
				},
			},
		],
  },
];

然后在按钮click事件里面添加router跳转

btnAAAClick () {
	this.$router.push('/home/bbb')
},

这样界面就跳转到bbb.vue里面了

你可能感兴趣的:(vue.js,javascript,前端)