feat: 更新加载数据的时机

This commit is contained in:
2026-09-11 16:21:35 +08:00
parent 115bc6cf06
commit a6a93484a5
2 changed files with 4 additions and 14 deletions

View File

@@ -42,7 +42,7 @@
<template #footer>
<view class="flex-1 flex justify-between items-center">
<view v-if="item.crop" class="flex flex-col gap-1" @click="updateCropClick(item)">
<view v-if="item.crop" class="flex flex-col gap-1">
<view class="text-base font-medium">
{{ item.crop.name }}
<text class="text-sm text-gray-400 font-normal ml-1">{{ item.crop.variety }}</text>
@@ -69,19 +69,17 @@
</liu-drag-button>
<patch-popup />
<crop-popup />
<view class="h-[10px]"></view>
</view>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { onLoad } from '@dcloudio/uni-app'
import appLogo from '@/static/logo.png'
import { usePatchStore } from "@/stores/patch";
import type { ICrop, IPatch } from "@/types";
import PatchPopup from "@/components/PatchPopup.vue";
import CropPopup from "@/components/CropPopup.vue";
defineOptions({ name: 'Home' })
@@ -106,7 +104,7 @@ const today = computed(() => {
return `${m}${d}日 周${w}`
})
onShow(async () => {
onLoad(async () => {
await loadData()
})
@@ -150,12 +148,4 @@ function handlePreview(crop: ICrop) {
const fullUrls = crop.images?.map(url => `${patchStore.baseUrl}/${url}`) as string[]
uni.previewImage({ urls: fullUrls, current: fullUrls[0] })
}
function updateCropClick(patch: IPatch) {
patchStore.currentPatch = patch
patchStore.showPatchFab = false
patchStore.cropForm = JSON.parse(JSON.stringify(patch.crop))
patchStore.cropApiType = 'UPDATE'
patchStore.showCropPopup = true
}
</script>

File diff suppressed because one or more lines are too long