大家好呀,我又来记录一下啦
实现功能:点击”查看“按钮,跳转到对应的tab页面
方法:router
按钮部分:
<el-button size="small" @click="check(scope.row.name)">查看</el-button>
对应的方法:
check(){
this.$router.push({path:'/about'})
},
router:
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import CataLogueView from '../views/CataLogueView.vue'
const routes = [
{
path: '/',
name: '目录',
component: CataLogueView
},
{
path: '/home',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
}
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
这样子就可以实现跳转啦,是不是并没有很难,加油!
标签:about,vue,import,跳转,tab,vue3,router,path From: https://blog.csdn.net/luciyana/article/details/137211232