feat(widget): 添加 postSlug 配置以支持多语言/多路径评论聚合
- 在配置面板和核心逻辑中新增 postSlug 字段,允许自定义评论标识符 - 更新前端配置文档,说明 postSlug 的用途和默认行为 - 当未配置 postSlug 时,默认仍使用 window.location.pathname
This commit is contained in:
@@ -32,7 +32,7 @@ export class CWDComments {
|
||||
if (config.siteId) {
|
||||
this.config.siteId = config.siteId;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
if (typeof window !== 'undefined' && !this.config.postSlug) {
|
||||
this.config.postSlug = window.location.pathname;
|
||||
}
|
||||
if (typeof document !== 'undefined') {
|
||||
@@ -577,7 +577,7 @@ export class CWDComments {
|
||||
if (newConfig.siteId !== undefined) {
|
||||
this.config.siteId = newConfig.siteId;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
if (typeof window !== 'undefined' && !this.config.postSlug) {
|
||||
this.config.postSlug = window.location.pathname;
|
||||
}
|
||||
if (typeof document !== 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user