Full-featured comment system
npm install vcmtvcomment 🧵 B3log 分布式社区的评论组件,欢迎加入下一代社区网络。
* 安装依赖
``shell`
npm install vcmt --save
* 在代码中引入并初始化对象,可参考 index.js
`ts
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 中插入 js,可参考 index-static.html
`html`
#### 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|图片延迟加载|