This commit is contained in:
shikong 2024-10-22 17:04:24 +08:00
parent f4d7e20fdb
commit d357ca671b
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
5 changed files with 92 additions and 7 deletions

View File

@ -33,6 +33,10 @@ function changeCurrent(index){
ctx.current = index ctx.current = index
} }
defineExpose({
changeCurrent
})
function isCurrent(index){ function isCurrent(index){
return ctx.current === index return ctx.current === index
} }

View File

@ -13,7 +13,7 @@
<view class="text-center flex flex-col flex-grow min-h-0"> <view class="text-center flex flex-col flex-grow min-h-0">
<TabView :tabs="ctx.tabs" class="flex-grow min-h-0"> <TabView :tabs="ctx.tabs" class="flex-grow min-h-0" ref="tabRef">
<template #default="{index}" class="h-full"> <template #default="{index}" class="h-full">
<SidebarView :categories="ctx.categories" v-show="index === 0" class="h-full"> <SidebarView :categories="ctx.categories" v-show="index === 0" class="h-full">
<template #default="{data}"> <template #default="{data}">
@ -40,18 +40,25 @@
</template> </template>
<script setup> <script setup>
import {reactive} from "vue"; import {reactive,ref} from "vue";
import {onLoad} from "@dcloudio/uni-app"; import {onLoad, onReady} from "@dcloudio/uni-app";
import ShopTitle from "./components/shop-title"; import ShopTitle from "./components/shop-title";
import TabView from "@/components/tab-view/index.vue"; import TabView from "@/components/tab-view/index.vue";
import SidebarView from "@/components/sidebar-view"; import SidebarView from "@/components/sidebar-view";
import Item from "@/components/tab-view/components/item"; import Item from "@/components/tab-view/components/item";
import Comments from "./components/comments/index.vue"; import Comments from "./components/comments/index.vue";
onLoad((query) => { let query = {}
const tabRef = ref()
onLoad((q) => {
query = q
console.log(query) console.log(query)
}) })
onReady(()=>{
tabRef.value.changeCurrent(query?.index || 0)
})
const ctx = reactive({ const ctx = reactive({
tabs: [ tabs: [
{ {
@ -77,6 +84,7 @@ const ctx = reactive({
value: "catering" value: "catering"
}] }]
}) })
</script> </script>

View File

@ -1,10 +1,17 @@
<script setup> <script setup>
import Rate from "./rate.vue";
import Tags from "./tags.vue";
</script> </script>
<template> <template>
<view class="flex flex-col w-full h-full"> <view class="flex flex-col w-full h-full bg-[#F4F4F4]">
评论 <view class="my-1">
<Rate />
</view>
<view class="my-1">
<Tags />
</view>
</view> </view>
</template> </template>

View File

@ -0,0 +1,53 @@
<script setup>
</script>
<template>
<view class="flex flex-col w-full h-full text-gray-400 text-sm bg-white">
<view class="flex text-center py-2">
<view class="w-1/4">
<view class="text-3xl text-orange-500">
4.7
</view>
<text>
商家评分
</text>
</view>
<view class="w-1/2 border-r border-r-gray-300 px-2">
<view class="flex flex-col justify-between h-full">
<view class="flex justify-between">
<view class="flex">
<text class="mr-5">口味</text>
<uni-rate :size="16" :value="4.7"/>
</view>
<text class="text-orange-500">4.7</text>
</view>
<view class="flex justify-between">
<view class="flex">
<text class="mr-5">包装</text>
<uni-rate :size="16" :value="3.6"/>
</view>
<text class="text-orange-500">3.6</text>
</view>
</view>
</view>
<view class="w-1/4">
<view class="text-2xl text-gray-500">
4.9
</view>
<text>
配送评分
</text>
</view>
</view>
</view>
</template>
<style scoped>
</style>

View File

@ -0,0 +1,13 @@
<script setup>
</script>
<template>
<view class="bg-white w-full">
</view>
</template>
<style scoped>
</style>