优化
This commit is contained in:
@@ -53,6 +53,7 @@ const orderPage = ref(1)
|
||||
const orderPageSize = ref(10)
|
||||
const customerOrdersLoading = ref(false)
|
||||
const customerOrdersError = ref<ApiErrorDetails | null>(null)
|
||||
let skipNextOrderPageLoad = false
|
||||
const previews = ref<Record<string, PreviewState>>({})
|
||||
const previewOpen = ref(false)
|
||||
const previewName = ref('')
|
||||
@@ -195,6 +196,7 @@ async function loadDetail() {
|
||||
|
||||
const optional: Promise<void>[] = []
|
||||
if (access.can('platform:order:list')) {
|
||||
if (orderPage.value !== 1) skipNextOrderPageLoad = true
|
||||
orderPage.value = 1
|
||||
customerOrders.value = []
|
||||
customerOrderTotal.value = 0
|
||||
@@ -254,6 +256,10 @@ function handleTabKeydown(event: KeyboardEvent, key: DetailTab) {
|
||||
onMounted(loadDetail)
|
||||
onBeforeUnmount(clearPreviews)
|
||||
watch(orderPage, (page, previousPage) => {
|
||||
if (skipNextOrderPageLoad) {
|
||||
skipNextOrderPageLoad = false
|
||||
return
|
||||
}
|
||||
if (page !== previousPage) void loadCustomerOrders(page)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user