docs(前端配置): 更新前端配置文档中的示例代码

添加DOMContentLoaded事件监听器的替代调用方式示例
This commit is contained in:
anghunk
2026-01-22 16:40:55 +08:00
parent a2aa350054
commit 83088a3837

View File

@@ -63,12 +63,23 @@ comments.updateConfig({ theme: 'dark' });
```html
<div id="comments"></div>
<script src="https://cwd.js.org/cwd.js"></script>
<!-- 实例调用 -->
<script>
const comments = new CWDComments({
el: '#comments',
apiBaseUrl: 'https://your-api.example.com', // 换成你的 API 地址
});
comments.mount();
// 或者
// document.addEventListener('DOMContentLoaded', () => {
// const comments = new window.CWDComments({
// el: '#comments',
// apiBaseUrl: 'https://your-api.example.com',
// });
// comments.mount();
// });
</script>
```