💡 简介
vcomment 🧵 B3log 分布式社区的评论组件,欢迎加入下一代社区网络。
🛠️ 使用文档
CommonJS
npm install vcmt --save
import Vcomment from '../src/index'
const vcomment = new Vcomment({
id: 'comments',
postId: '1353745196751',
userName: 'vanessa',
url: 'http://localhost:8080',
currentPage: 3,
vditor: {
hljsEnable: false,
hljsStyle: "github"
}
})
vcomment.render()
HTML script
<!-- ⚠️生产环境请指定版本号,如 https://cdn.jsdelivr.net/npm/vcmt@x.x.x/dist... -->
<script src="https://cdn.jsdelivr.net/npm/vcmt/dist/index.min.js" defer></script>
示例代码
API
options
|
说明 |
默认值 |
id |
渲染元素的 id |
- |
postId |
文章 id |
- |
userName |
用户名 |
- |
url |
评论 API 地址 |
"https://ld246.com" |
currentPage |
评论页码 |
1 |
error |
获取列表错误回调 |
- |
vditor |
编辑器参数 |
- |
vditor.hljsEnable |
是否启用高亮 |
true |
vditor.hljsStyle |
高亮样式 |
"github" |
vditor.emoji |
自定义表情 { [key: string]: string } |
{} |
vditor.lang |
语言 |
'zh_CN' |
methods
|
说明 |
render |
渲染评论 |
parseMarkdown(vditorOptions: IOptionsVditor) |
Markdown 渲染 |
lazyLoadImage |
图片延迟加载 |
欢迎关注 B3log 开源社区微信公众号 B3log开源