Fix: Note List Page Styles

样式调整,显示站点名称,获取日记首图,列表页参数获取
This commit is contained in:
2023-11-08 02:04:52 +08:00
parent db8a91e6ee
commit f64113a756
5 changed files with 56 additions and 18 deletions
+7
View File
@@ -1,3 +1,10 @@
// 站点名称
export const siteTitle = (title?: string) => {
const siteName = import.meta.env.APP_SITENAME;
return title ? `${title} - ${siteName}` : siteName;
}
// Classnames
export const clsn = (...clsn: (string | undefined | null | false)[]) => {
return clsn.filter(item => item).join(" ");
+11
View File
@@ -0,0 +1,11 @@
// 获取第一张图片
export const getFirstImage = (note: API.Note.INoteData) => {
if (note.media && note.media.length > 0) {
return note.media[0].url;
}
// 遗留版本
if (note.photo && note.photo.length > 0) {
return note.photo[0].url;
}
}