This commit is contained in:
shikong 2024-10-22 19:28:47 +08:00
parent d357ca671b
commit 12e06a8b32
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
2 changed files with 50 additions and 3 deletions

View File

@ -52,7 +52,7 @@ onLoad(() => {
<template> <template>
<view class="w-full h-full"> <view class="w-full h-full">
<view class="w-full h-full flex flex-col" v-if="props.tabs && props.tabs.length > 0"> <view class="w-full h-full flex flex-col bg-white" v-if="props.tabs && props.tabs.length > 0">
<view class="text-left p-2"> <view class="text-left p-2">
<view class="inline-block mx-2" v-for="(item, index) in props.tabs" :key="index" <view class="inline-block mx-2" v-for="(item, index) in props.tabs" :key="index"
:class="{'font-bold': isCurrent(index)}" :class="{'font-bold': isCurrent(index)}"

View File

@ -1,10 +1,57 @@
<script setup> <script setup>
import {reactive} from "vue"
const ctx = reactive({
current: "-1",
tags: [
{
name: "全部",
value: "-1"
},
{
name: "有图评价",
value: "0"
},
{
name: "好评",
value: "1"
},
{
name: "中评",
value: "2"
},
{
name: "差评",
value: "3"
},
{
name: "味道赞",
value: "5"
},
{
name: "服务好",
value: "6"
}
],
})
function isCurrent(item) {
return ctx.current === item.value
}
function changeCurrent(item) {
ctx.current = item.value
}
</script> </script>
<template> <template>
<view class="bg-white w-full"> <view class="bg-white w-full text-left flex flex-wrap">
<view class="border inline-block m-2 px-3 py-2" v-for="item in ctx.tags" :key="item.value"
@tap="changeCurrent(item)"
:class="{'text-orange-500 border-orange-500':isCurrent(item), 'border-gray-300 text-gray-400': !isCurrent(item)}">
{{ item.name }}
</view>
</view> </view>
</template> </template>