37 lines
1.4 KiB
Vue
37 lines
1.4 KiB
Vue
<!-- Ported from legacy henza_pwa/src/views/newest.vue.
|
|||
|
|
See useProducts.ts for the pagination-simplification note. -->
|
||
|
|
<template>
|
||
|
|
<Spinner :spinning="loadingPage" tip="درحال دریافت اطلاعات">
|
||
|
|
<AppHeader>
|
||
|
|
<nav class="flex justify-start items-center">
|
||
|
|
<router-link :to="{ name: 'home' }" class="h-[25px] w-[25px]">
|
||
|
|
<Icon icon="vuesax-linear:arrow-right-1" class="cursor-pointer text-white" size="28" />
|
||
|
|
</router-link>
|
||
|
|
<h4 class="text-white bold mb-0 mr-[20%] md:mr-[40%]">جدید ترین محصولات</h4>
|
||
|
|
</nav>
|
||
|
|
</AppHeader>
|
||
|
|
<ProductList padding="81px" class="px-[16px] pb-[66px]" @pull="pull" :value="productsData.productList" :loading="loadingPull" :flag="productsData.flag" />
|
||
|
|
</Spinner>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup lang="ts">
|
||
|
|
import { onBeforeMount, ref } from 'vue'
|
||
|
|
import Icon from '../components/icon/Icon.vue'
|
||
|
|
import AppHeader from '../components/AppHeader.vue'
|
||
|
|
import Spinner from '../components/Spinner.vue'
|
||
|
|
import ProductList from '../components/product/ProductList.vue'
|
||
|
|
import { useProducts } from '../composables/useProducts'
|
||
|
|
|
||
|
|
const { productsData, getProducts } = useProducts()
|
||
|
|
|
||
|
|
const loadingPage = ref(false)
|
||
|
|
const loadingPull = ref(false)
|
||
|
|
|
||
|
|
onBeforeMount(async () => {
|
||
|
|
await getProducts(loadingPage, false)
|
||
|
|
})
|
||
|
|
const pull = async () => {
|
||
|
|
await getProducts(loadingPull, true)
|
||
|
|
}
|
||
|
|
</script>
|