feat: 更新加载数据的时机
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<view class="flex-1 flex justify-between items-center">
|
<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">
|
<view class="text-base font-medium">
|
||||||
{{ item.crop.name }}
|
{{ item.crop.name }}
|
||||||
<text class="text-sm text-gray-400 font-normal ml-1">{{ item.crop.variety }}</text>
|
<text class="text-sm text-gray-400 font-normal ml-1">{{ item.crop.variety }}</text>
|
||||||
@@ -69,19 +69,17 @@
|
|||||||
</liu-drag-button>
|
</liu-drag-button>
|
||||||
|
|
||||||
<patch-popup />
|
<patch-popup />
|
||||||
<crop-popup />
|
|
||||||
<view class="h-[10px]"></view>
|
<view class="h-[10px]"></view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import appLogo from '@/static/logo.png'
|
import appLogo from '@/static/logo.png'
|
||||||
import { usePatchStore } from "@/stores/patch";
|
import { usePatchStore } from "@/stores/patch";
|
||||||
import type { ICrop, IPatch } from "@/types";
|
import type { ICrop, IPatch } from "@/types";
|
||||||
import PatchPopup from "@/components/PatchPopup.vue";
|
import PatchPopup from "@/components/PatchPopup.vue";
|
||||||
import CropPopup from "@/components/CropPopup.vue";
|
|
||||||
|
|
||||||
defineOptions({ name: 'Home' })
|
defineOptions({ name: 'Home' })
|
||||||
|
|
||||||
@@ -106,7 +104,7 @@ const today = computed(() => {
|
|||||||
return `${m}月${d}日 周${w}`
|
return `${m}月${d}日 周${w}`
|
||||||
})
|
})
|
||||||
|
|
||||||
onShow(async () => {
|
onLoad(async () => {
|
||||||
await loadData()
|
await loadData()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -150,12 +148,4 @@ function handlePreview(crop: ICrop) {
|
|||||||
const fullUrls = crop.images?.map(url => `${patchStore.baseUrl}/${url}`) as string[]
|
const fullUrls = crop.images?.map(url => `${patchStore.baseUrl}/${url}`) as string[]
|
||||||
uni.previewImage({ urls: fullUrls, current: fullUrls[0] })
|
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>
|
</script>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user