♻️ 动态获取版块

This commit is contained in:
目棃
2025-01-16 15:51:03 +08:00
parent e8a79fb409
commit 8ecaed05ea
10 changed files with 297 additions and 135 deletions

View File

@@ -21,9 +21,10 @@
</div>
</template>
<script lang="ts" setup>
import Mys from "@Mys/index.js";
import { onMounted, shallowRef } from "vue";
import ApiHubReq from "@/web/request/apiHubReq.js";
type TpVote = { insert: { vote: { id: string; uid: string } } };
type TpVoteProps = { data: TpVote };
type TpVoteData = { title: string; count: number; percent: number };
@@ -34,8 +35,8 @@ const votes = shallowRef<TpVoteInfo>();
onMounted(async () => {
const vote = props.data.insert.vote;
const voteInfo = await Mys.ApiHub.getVotes(vote.id, vote.uid);
const voteResult = await Mys.ApiHub.getVoteResult(vote.id, vote.uid);
const voteInfo = await ApiHubReq.vote.info(vote.id, vote.uid);
const voteResult = await ApiHubReq.vote.result(vote.id, vote.uid);
votes.value = {
title: voteInfo.title,
count: voteResult.user_cnt,