评论:区块挂在 site.comments_enabled 上,后端就绪前线上不渲染
阶段一刚推上去就暴露一个问题:线上 8080 是真实环境,评论区组件照常渲染, 而 /api/comments 还不存在 —— 真实访客看到「请求失败(404)」和 「站点还没配置登录方式」。 修法:CommentSection 用 v-if="!!Number(site.comments_enabled)" 兜住。 settings 是 KV 字符串,'1'/1/true 都算开;后端阶段二把这个字段加进 model.Settings 后 /api/site 自然下发,区块自动出现,前端不用再动。 mock 里手动 site.comments_enabled = true,评审不受影响。 实测:mock 模式照常显示(共 8 条评论);线上 8080 的 .cm-sec 不再渲染、 无 404 错误。
This commit is contained in:
1 parent
815eff9f9a
commit
f29d8e053a
2 files changed
+10
-1
No files matched your search
@@ -102,6 +102,9 @@ export function install() {
|
||||
const state = q.get('state') || 'default'
|
||||
applyState(state)
|
||||
|
||||
// 评论区总开关:真后端没这个字段前线上是关的,mock 里手动打开
|
||||
site.comments_enabled = true
|
||||
|
||||
// 评审用:?ui=classic 强制走 classic 那套壳。站点平时是 vivid,classic 分支
|
||||
// 平时根本渲染不出来,不加这个就没法给它截图 / 做探针。
|
||||
// 改 ui_id 会触发 site.js 里的 watcher,applyTheme 由它调。
|
||||
|
||||
Reference in new issue
Block a user