84 lines
1.4 KiB
Vue
84 lines
1.4 KiB
Vue
<script setup>
|
|
import { ref, onMounted } from 'vue';
|
|
import { onLoad, onShow, onReady, onHide, onPullDownRefresh } from '@dcloudio/uni-app';
|
|
import CustomTabBar from '@/components/CustomTabBar.vue'
|
|
|
|
|
|
import { getProducts } from './api.js';
|
|
import { useUserStore } from '@/store/user.js';
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
const { t, locale } = useI18n();
|
|
const userStore = useUserStore();
|
|
|
|
|
|
/**
|
|
* @desc 跳转至详情页面
|
|
*/
|
|
const toDetailPage = (productId) => {
|
|
uni.navigateTo({
|
|
url: '/pages/product/detail',
|
|
});
|
|
};
|
|
//获取首页数据
|
|
const getProductList = async()=>{
|
|
const res = await getProducts();
|
|
|
|
productData.value=res.data;
|
|
console.log("商品数据",productData.value);
|
|
}
|
|
|
|
|
|
onLoad(()=>{
|
|
|
|
});
|
|
|
|
// 模拟数据
|
|
|
|
|
|
/**
|
|
* @desc 处理预订事件
|
|
*/
|
|
const handleBook = (productId) => {
|
|
// 这里可以添加预订逻辑,比如跳转到详情页
|
|
uni.navigateTo({
|
|
url: `/pages/product/detail?id=${productId}`,
|
|
});
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<view class="h-[100vh] bg-[#9C032D]">
|
|
|
|
<CustomTabBar />
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
:deep(.u-count-down__text) {
|
|
color: #ab002d !important;
|
|
font-size: 13px !important;
|
|
}
|
|
|
|
.navigation {
|
|
border-bottom: 1px solid #f2f2f2;
|
|
}
|
|
|
|
.navi-title-center {
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
.line {
|
|
transition: 0.3s all;
|
|
}
|
|
|
|
.search {
|
|
:deep(.u-search) {
|
|
flex: 1;
|
|
}
|
|
}
|
|
</style>
|