+
+
-
-
{{i.name}}
-
{{i.desc}}
-
+
+
+
+
{{ 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);
});