1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-06-12 13:19:31 +08:00

feat: 添加文章访问统计功能

1. 新增getDomainOnly工具函数用于提取URL域名
2. 新增postTrackersCounter接口调用方法
3. 在文章详情页添加访问数据上报 #31 #41
This commit is contained in:
小莫唐尼
2026-06-05 13:20:25 +08:00
parent 0b4090f9e9
commit de142c4729
3 changed files with 30 additions and 1 deletions
+9
View File
@@ -50,3 +50,12 @@ export function jsonToUrlParams2(json) {
})
).join('&')
}
/**
* 仅获取域名
* @param {String} url
* @returns {String}
*/
export function getDomainOnly(url){
return url.replace(/^(https?:\/\/)/, '').split('/')[0]
}