Files
PC-Light-Forum/component/item-forum/item-forum.js
DESKTOP-RQ919RC\Pc 5cdbeb249f feat: 优化页面布局和交互体验
- 使用sticky定位替代fixed定位,提升滚动体验
- 添加视频播放图标和图片展示功能
- 实现搜索框热门关键词轮播效果
- 优化编辑器链接插入功能
- 调整组件样式和布局细节
2025-11-10 19:06:58 +08:00

41 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// my-component.js
// 引入全局 Vue 对象(因在 HTML 中通过 script 引入Vue 已挂载到 window
const { defineComponent, ref } = Vue;
import { itemBottom } from "../item-bottom/item-bottom.js";
import { itemHead } from "../item-head/item-head.js";
// 定义组件(直接使用模板)
export const itemForum = defineComponent({
name: "item-forum",
props: {
itemdata: {
type: Object,
default: () => {},
},
page: {
type: String,
default: "",
},
},
setup(props) {
let res = props.itemdata || {};
res.content = res?.content?.replace(/\[.*?\]/g, "");
res.content = res?.content?.replace(/\<.*?\>/g, "");
res.content = res?.content?.replace(/\[.*?\../g, "");
let item = ref({ ...res });
item.value['url'] = '/details/' + item.value.uniqid;
return { item };
},
components: {
itemBottom,
itemHead,
},
template: `<div class="item-box item-forum"> <item-head :itemdata="item" :page="page"></item-head> <a v-if="item.title" class="title" :href="item.url" target="_blank">{{ item.title }}</a> <a class="message two-line-display" :href="item.url" target="_blank">{{ item.content }}</a> <a class="picture flexacenter" :href="item.url" target="_blank" v-if="item.images?.length != 0 || item.videos?.length != 0"> <img class="picture-item" v-for="(item, index) in item.images" :key="index" :src="item.url" alt=""> <div class="picture-videos"> <img class="picture-item" v-for="(item, index) in item.videos" :key="index" :src="item.posterurl" alt=""> <img class="icon-play" src="/img/videoplay.png" alt=""> </div> </a> <item-bottom :itemdata="item" :page="page"></item-bottom></div>`,
});