Vue 3.0之路由传参

在 vue3.0 里面使用路由必须要引入 useRouter 和 useRoute

import { useRoute, useRouter } from vue-router
function useHooks() {
  const Router = useRouter() //跳转
  const Route = useRoute() //获取到值
  const Routeid = computed(() => {
    return Route.query.id
  })
  const gotourl = () => {
    console.log(aaaaa了)
    Router.push({
      path: /about,
      query: {
        id: aaaaaa,
      },
    })
  }
  return {
    gotourl,
    Routeid,
  }
}

 

Vue 3.0之路由传参

上一篇:PhonePhonePhone


下一篇:浪潮nf5270m5 安装2012