vue3 路由跳转携带参数

这种写法防止url地址携带 多选的大量数据

//name:路由name,params:携带参数
router.push({name:'RoutePushEdit',params:{id:id}});
import {useRoute} from 'vue-router';
   onMounted(() => {
      const param = route.params;
      console.log(param.id);
    });

第二种写法

    router.push({
            path: '/selectOnHand-cancelLockBig',
             query: { ids: id },
          });
import {useRoute} from 'vue-router';
    onMounted(() => {
      const param = route.query;
       console.log(param.id);
    });

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