mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
Update Comment.astro
This commit is contained in:
@@ -2,25 +2,41 @@
|
|||||||
// src/components/Comment.astro
|
// src/components/Comment.astro
|
||||||
---
|
---
|
||||||
|
|
||||||
<div id="tcomment"></div>
|
<div id="tcomment" class="twikoo-wrap"></div>
|
||||||
|
|
||||||
|
<!-- 使用本地 JS 文件(放在 public/js/twikoo.all.min.js) -->
|
||||||
|
<script is:inline src="/js/twikoo.all.min.js"></script>
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
function initTwikoo() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
try {
|
if (typeof twikoo !== 'undefined') {
|
||||||
twikoo.init({
|
twikoo.init({
|
||||||
// 👇 替换成你自己的 Twikoo 环境 ID(例如 https://twikoo.yourdomain.com)
|
|
||||||
envId: 'http://47.108.235.131:40063/',
|
envId: 'http://47.108.235.131:40063/',
|
||||||
el: '#tcomment',
|
el: '#tcomment',
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} else {
|
||||||
console.error('Twikoo 初始化失败:', e);
|
console.error('Twikoo 未加载');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script
|
<!-- 全局样式修复:彻底移除评论区内所有可点击控件的下划线和边框 -->
|
||||||
is:inline
|
<style is:global>
|
||||||
defer
|
.twikoo-wrap a,
|
||||||
src="https://cdn.jsdelivr.net/npm/twikoo@1/dist/twikoo.all.min.js"
|
.twikoo-wrap button,
|
||||||
onload="initTwikoo()"
|
.twikoo-wrap .tk-submit,
|
||||||
></script>
|
.twikoo-wrap .tk-action,
|
||||||
|
.twikoo-wrap .tk-input,
|
||||||
|
.twikoo-wrap .tk-comment-link,
|
||||||
|
.twikoo-wrap .tk-reply-link {
|
||||||
|
text-decoration: none !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
/* 保证输入框底部边框为正常颜色,不是黑色 */
|
||||||
|
.twikoo-wrap input,
|
||||||
|
.twikoo-wrap textarea {
|
||||||
|
border: 1px solid #ccc !important;
|
||||||
|
border-bottom: 1px solid #ccc !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user