diff --git a/src/router/index.js b/src/router/index.js index 831f67f..77ed67d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -56,6 +56,10 @@ const router = createRouter({ path: "/mini/:id", component: () => import("@/views/article/mini/index.vue"), }, + { + path: "/cook/:id", + component: () => import("@/views/cookbook/detail.vue"), + }, { path: "/console", component: () => import("@/views/console/index.vue"), diff --git a/src/views/cookbook/detail.vue b/src/views/cookbook/detail.vue new file mode 100644 index 0000000..bad3c21 --- /dev/null +++ b/src/views/cookbook/detail.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/src/views/cookbook/index.vue b/src/views/cookbook/index.vue index d8189a4..daf83a2 100644 --- a/src/views/cookbook/index.vue +++ b/src/views/cookbook/index.vue @@ -8,7 +8,7 @@
+ v-for="(i, idx) in cooks.list" @click="handdleGotoDetail(i.id)">
@@ -46,6 +46,7 @@ const cooks = ref({ list: [] }); const page = ref(1); const card = ref(null); const cardWidth = ref(0); +const router = useRouter(); //mark method async function getCate(id) { const res = await $http.cookbook.category({ id }); @@ -97,6 +98,10 @@ function handdleSelect() { getCooks(category.value, page.value) } +function handdleGotoDetail(id) { + router.push(`/cook/${id}`) +} + //mark 周期、内置函数等 onMounted(async () => { box.value.style.height = document.documentElement.clientHeight - 100 + 'px';