diff --git a/src/views/cookbook/index.vue b/src/views/cookbook/index.vue index 30b252f..d8189a4 100644 --- a/src/views/cookbook/index.vue +++ b/src/views/cookbook/index.vue @@ -2,18 +2,29 @@
+ :show-path="true" remote :on-load="handleLoad" @update:value="handdleSelect" />
-
-
+
+
-
-
{{i.name}}
-
{{i.desc}}
-
+ + +
+
{{ i.name }}
+
{{ i.desc }}
+
+
+
@@ -24,14 +35,17 @@ + //mark import //mark data const box = ref(null); const category = ref(null) const clist = ref([]) -const cooks = ref([]); +const cooks = ref({ list: [] }); const page = ref(1); +const card = ref(null); +const cardWidth = ref(0); //mark method async function getCate(id) { const res = await $http.cookbook.category({ id }); @@ -40,9 +54,17 @@ async function getCate(id) { } async function getCooks(id, page) { - const res = await $http.cookbook.list({ id, page }); - console.log(111111, res.data); - cooks.value = res.data; + setTimeout(async () => { + const res = await $http.cookbook.list({ id, page }); + + cooks.value = res.data; + console.log(2222, cooks.value); + + + // console.log(111111, card.value); + cardWidth.value = card.value[0].clientWidth; + // console.log(111111, cardWidth.value); + }, 1000); } function handleLoad(option) { @@ -70,13 +92,14 @@ async function getChildren(option) { } +function handdleSelect() { + console.log(category.value); + getCooks(category.value, page.value) +} + //mark 周期、内置函数等 onMounted(async () => { box.value.style.height = document.documentElement.clientHeight - 100 + 'px'; - - - - const res = await $http.cookbook.category({ id: -1 }) clist.value = res.data; clist.value.forEach(item => { @@ -88,7 +111,7 @@ onMounted(async () => { console.log(clist.value); setTimeout(() => { - getCooks(3, page.vue) + getCooks(3, page.value) }, 1000); });