refactor: 重构组件模板,统一使用相对路径和内部路由 style: 调整CSS样式,修复布局和间距问题 fix: 修复投票和offer组件链接错误问题 chore: 添加新图片资源并更新相关引用路径 perf: 移除调试日志,优化页面加载性能 docs: 更新组件注释和文档说明 test: 更新测试用例以适配新功能 ci: 调整构建配置以支持新资源文件 build: 更新依赖项以兼容新功能
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
// 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: () => {},
|
||
},
|
||
},
|
||
|
||
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 });
|
||
return { item };
|
||
},
|
||
|
||
components: {
|
||
itemBottom,
|
||
itemHead,
|
||
},
|
||
|
||
template: `<div class="item-box item-forum"> <item-head :itemdata="item"></item-head> <a v-if="item.title" class="title" :href="'/details/' + item.uniqid" target="_blank">{{ item.title }}</a> <a class="message two-line-display" :href="'/details/' + item.uniqid" target="_blank">{{ item.content }}</a> <item-bottom :itemdata="item"></item-bottom></div>`,
|
||
});
|