feat: 新增详情页和个人主页功能及组件优化
- 添加详情页(details.html)和个人主页(homepage-me.html)的完整功能实现 - 新增多个图片资源用于UI展示 - 优化item-head、item-bottom等组件的数据绑定和交互逻辑 - 添加公共工具函数(public.js)包括时间处理和网络请求 - 完善CSS样式文件,增加响应式布局和交互效果 - 实现用户信息展示、帖子详情、相关帖子推荐等功能模块 - 添加签到、投币等交互功能 - 优化组件模板结构和数据传递方式
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// my-component.js
|
||||
// 引入全局 Vue 对象(因在 HTML 中通过 script 引入,Vue 已挂载到 window)
|
||||
const { defineComponent } = Vue;
|
||||
const { defineComponent, ref } = Vue;
|
||||
import { itemBottom } from "../item-bottom/item-bottom.js";
|
||||
import { itemHead } from "../item-head/item-head.js";
|
||||
|
||||
@@ -8,16 +8,20 @@ import { itemHead } from "../item-head/item-head.js";
|
||||
export const itemForum = defineComponent({
|
||||
name: "item-forum",
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "默认标题",
|
||||
itemdata: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
// 方法
|
||||
methods: {
|
||||
handleClick() {
|
||||
alert("组件按钮被点击");
|
||||
},
|
||||
|
||||
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: {
|
||||
@@ -25,5 +29,5 @@ export const itemForum = defineComponent({
|
||||
itemHead,
|
||||
},
|
||||
|
||||
template: `<div class="item-box item-forum"> <item-head></item-head> <div class="label flexflex"> <img class="item icon" src="./img/recommend-icon.png" /> <img class="item icon" src="./img/essence-icon.png" /> <div class="item blue">香港</div> <div class="item">香港</div> </div> <div class="title">【干货】香港留学费用准备</div> <div class="message">在即将赴港的时候,很多同学好奇香港一年制硕士下来的整体费用大概是多少,其实主要包括学费,租房费和生活费三部分。学费的话根据不同香港来定,大概在10-30万港币之间,比较固定…</div> <item-bottom></item-bottom></div>`,
|
||||
template: `<div class="item-box item-forum"> <item-head :itemdata="item"></item-head> <div v-if="item.title" class="title">{{ item.title }}</div> <div class="message two-line-display">{{ item.content }}</div> <item-bottom :itemdata="item"></item-bottom></div>`,
|
||||
});
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
<div class="item-box item-forum">
|
||||
<item-head></item-head>
|
||||
<div class="label flexflex">
|
||||
<img class="item icon" src="./img/recommend-icon.png" />
|
||||
<img class="item icon" src="./img/essence-icon.png" />
|
||||
<div class="item blue">香港</div>
|
||||
<div class="item">香港</div>
|
||||
</div>
|
||||
<item-head :itemdata="item"></item-head>
|
||||
|
||||
<div class="title">【干货】香港留学费用准备</div>
|
||||
<div v-if="item.title" class="title">{{ item.title }}</div>
|
||||
|
||||
<div class="message">在即将赴港的时候,很多同学好奇香港一年制硕士下来的整体费用大概是多少,其实主要包括学费,租房费和生活费三部分。学费的话根据不同香港来定,大概在10-30万港币之间,比较固定…</div>
|
||||
<div class="message two-line-display">{{ item.content }}</div>
|
||||
|
||||
<item-bottom></item-bottom>
|
||||
<item-bottom :itemdata="item"></item-bottom>
|
||||
</div>
|
||||
Reference in New Issue
Block a user