This commit is contained in:
yanghao05
2025-04-29 10:15:36 +08:00
parent 75e39a0283
commit da8ad94eda
9 changed files with 232 additions and 35 deletions

View File

@@ -2,6 +2,7 @@
import Plyr from 'plyr'
import 'plyr/dist/plyr.css'
import { onMounted, onUnmounted, ref } from 'vue'
import { BsChevronLeft } from 'vue-icons-plus/bs'
import { useRoute, useRouter } from 'vue-router'
import { postApi } from '../api/postApi'
@@ -111,10 +112,7 @@ onUnmounted(() => {
<div class="min-h-screen bg-gray-50 flex flex-col">
<div class="bg-white h-12 flex items-center px-4 border-b border-gray-100">
<button @click="handleBack" class="text-gray-700">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" />
</svg>
<BsChevronLeft class="w-6 h-6" />
</button>
</div>

View File

@@ -49,9 +49,6 @@ useIntersectionObserver(
}
)
const showArticle = (id) => {
router.push(`/posts/${id}`)
}
const handleSearch = () => {
articles.value = []
@@ -86,8 +83,8 @@ onMounted(() => {
暂无文章
</div>
<ArticleListItem v-for="article in articles" :key="article.id" :article="article"
@click="showArticle(article.id)" class="mb-4" />
<ArticleListItem v-for="article in articles" :key="article.id" :article="{ ...article, bought: true }"
class="mb-4" />
<div ref="loadingTrigger" class="py-4 text-center" v-show="hasMore || loading">
<div v-if="loading"

View File

@@ -47,10 +47,6 @@ useIntersectionObserver(
}
)
const showArticle = (id) => {
router.push(`/posts/${id}`)
}
onMounted(() => {
fetchArticles()
})
@@ -70,8 +66,9 @@ onMounted(() => {
暂无已购买
</div>
<ArticleListItem v-for="article in purchasedArticles" :key="article.id" :article="article"
@click="showArticle(article.id)" class="mb-4" />
<div v-for="article in purchasedArticles" :key="article.id" class="mb-4">
<ArticleListItem :article="{ ...article, bought: true }" />
</div>
<div ref="loadingTrigger" class="py-4 text-center" v-show="hasMore || loading">
<div v-if="loading"