首先 定義路由,添加參數
{
name: 'preview',
path: 'preview/:id', //參數 component: () => import( '@/--------' )
}
傳參時使用name和params
this.$router.push({ name: 'preview', params: { id } });
然后用 this.$route.params 取參數 繼續做處理就行了