feat(comments): 添加评论组件自动获取页面标题和URL功能

refactor(email): 简化评论回复邮件通知逻辑
fix(docs): 移除过时的EMAIL_ADDRESS配置说明
style(store): 修改loading初始状态为true
This commit is contained in:
anghunk
2026-01-19 21:26:03 +08:00
parent a722788cc9
commit 5eee1ed8dc
6 changed files with 56 additions and 58 deletions

View File

@@ -28,6 +28,12 @@ export class CWDComments {
*/
constructor(config) {
this.config = { ...config };
if (!this.config.postTitle && typeof document !== 'undefined') {
this.config.postTitle = document.title || this.config.postSlug;
}
if (!this.config.postUrl && typeof window !== 'undefined') {
this.config.postUrl = window.location.href;
}
this.hostElement = this._resolveElement(config.el);
this.shadowRoot = null;
this.mountPoint = null;

View File

@@ -102,7 +102,7 @@ export function createCommentStore(config, fetchComments, submitComment) {
const store = new Store({
// 评论数据
comments: [],
loading: false,
loading: true,
error: null,
// 分页