Files
tk-mini-program-PC/src/views/hosts/Forum.vue

99 lines
2.0 KiB
Vue
Raw Normal View History

2025-07-31 22:07:21 +08:00
<template>
2025-08-05 22:07:07 +08:00
<!-- 站内信 -->
2025-07-31 22:07:21 +08:00
<div class="forum">
<div v-infinite-scroll="load" class="infinite-list" style="overflow: auto">
2025-08-12 22:05:06 +08:00
<el-card style="width: 90%" class="card" v-for="(item, index) in NoticeList" :key="index">
2025-07-31 22:07:21 +08:00
<template #header>
<div class="card-header">
2025-08-12 22:05:06 +08:00
<span>{{ item.title }}</span>
2025-07-31 22:07:21 +08:00
</div>
</template>
2025-08-12 22:05:06 +08:00
<div class="card-body">
{{ item.content }}
</div>
2025-07-31 22:07:21 +08:00
<template #footer>
<div class="card-footer">
2025-08-12 22:05:06 +08:00
<span>{{ item.time }}</span>
2025-07-31 22:07:21 +08:00
</div>
</template>
</el-card>
</div>
</div>
</template>
<script setup>
import {
ref, // 响应式基础
watch, // 侦听器
onMounted, // 组件挂载完成后执行
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
} from "vue";
2025-08-12 22:05:06 +08:00
import { getNoticeList } from "@/api/account";
2025-07-31 22:07:21 +08:00
const refname = ref("");
2025-08-12 22:05:06 +08:00
const NoticeList = ref([]);
2025-07-31 22:07:21 +08:00
function load() {
// 加载更多数据
}
watch(refname, async (newQuestion, oldQuestion) => {
// 变化后执行
});
onMounted(() => {
2025-08-12 22:05:06 +08:00
getNoticeList({page: 0, size: 10}).then((res) => {
NoticeList.value = res;
});
2025-07-31 22:07:21 +08:00
});
onUpdated(() => {
// 组件更新后执行
});
onUnmounted(() => {
// 组件销毁前执行
});
</script>
<style scoped lang="less">
.forum {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
2025-08-20 22:11:41 +08:00
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
2025-07-31 22:07:21 +08:00
}
.infinite-list {
width: 90%;
height: 90%;
display: flex;
flex-direction: column;
align-items: center;
}
2025-08-12 22:05:06 +08:00
.card{
border-radius: 16px;
border: 1px solid #4FCACD;
background-image: linear-gradient(180deg, #E4FFFF, #FFFFFF);
}
2025-07-31 22:07:21 +08:00
.card-header{
font-size: 18px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
}
.card-footer{
font-size: 14px;
display: flex;
justify-content:flex-end;
align-items: center;
}
2025-08-12 22:05:06 +08:00
.card-body{
color: #333333;
2025-08-15 13:05:19 +08:00
font-size: 16px;
2025-08-12 22:05:06 +08:00
}
2025-07-31 22:07:21 +08:00
</style>