Skip to content

Commit

Permalink
feat: move current city first
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Mar 5, 2024
1 parent 38fe019 commit b672420
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions components/City.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import CreateLog from './CreateLog.vue';
const props = defineProps<{ city: CityInfo }>();
const currentCity = props.city;
const timestamp = useTimestamp({ interval: 10 * 1000 });
const store = useLatestLogs();
Expand All @@ -37,16 +39,28 @@ const store = useLatestLogs();
<CardContent>
<Table>
<TableHeader>
<TableRow
<TableRow class="boder-t"
><TableHead class="w-[120px]">商品</TableHead
><TableHead v-for="city in cities" :key="city.name">{{ city.name }}</TableHead
><TableHead class="border-r">{{ currentCity.name }}</TableHead
><TableHead
v-for="city in cities.filter((c) => c.name !== currentCity.name)"
:key="city.name"
>{{ city.name }}</TableHead
><TableHead class="w-[100px]">操作</TableHead></TableRow
>
</TableHeader>
<TableBody>
<TableRow v-for="product in city.products" :key="product.name">
<TableCell>{{ product.name }}</TableCell>
<TableCell v-for="target in cities" :key="target.name"
<TableCell class="border-r"
><Price
:timestamp="timestamp"
:log="store.getLatestLog(city.name, product.name, currentCity.name)"
></Price
></TableCell>
<TableCell
v-for="target in cities.filter((c) => c.name !== currentCity.name)"
:key="target.name"
><Price
:timestamp="timestamp"
:log="store.getLatestLog(city.name, product.name, target.name)"
Expand Down

0 comments on commit b672420

Please sign in to comment.