优化:文章元数据信息增加所属分类和标签列表

This commit is contained in:
2022-08-09 21:25:55 +08:00
parent 3cc0ccf262
commit a4b4d71385
3 changed files with 56 additions and 8 deletions

View File

@@ -6,4 +6,18 @@
export function formatDate(date) {
const formatDate = new Date(date)
return formatDate.toLocaleString('zh', {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric'})
}
/**
* 获取URL路径中的指定参数
* @param paramName 参数名
* @returns 参数值
*/
export function getQueryParam(paramName) {
const reg = new RegExp("(^|&)"+ paramName +"=([^&]*)(&|$)")
let value = window.location.search.substr(1).match(reg)
if (value != null) {
return unescape(value[2])
}
return null
}