Files
qwqcode bad248534c docs: revise and add more examples
BREAKING CHANGE: The following top-level functions exported by the 'artalk' npm package have been deprecated: `Artalk.update`, `Artalk.reload`, and `Artalk.destroy`. These methods now require invocation on an instance created by either `Artalk.init` or `new Artalk`. Please utilize instance-level methods instead, such as `artalkInstance.update`. For more information, refer to  [the documentation](https://artalk.js.org/guide/frontend/import-framework.html). The update was implemented to enable the concurrent creation of multiple instances, adapting to situations where Vue components are simultaneously referenced across various pages. Initially, only a singular instance was permitted to mitigate memory leak concerns. However, this proved limiting for scenarios involving the caching of multiple component instances through 'keep-alive.' To better suit intricate SPA application needs, the choice was made to permit the creation of multiple independent instances. It's crucial to remember to manually invoke the `artalk.destroy` method when releasing components to avoid memory leaks (Issue #660).
2023-12-17 19:16:33 +08:00

1.6 KiB

Event

基本事件

事件名 描述
inited 初始化后
destroy 实例销毁时
list-fetch 评论列表请求时
list-fetched 评论列表请求后
list-load 评论装载前
list-loaded 评论装载后
list-error 评论加载错误时
list-goto-first 评论列表归位时
list-reach-bottom 评论列表滚动到底部时
list-reach-bottom 评论列表滚动到底部时
comment-inserted 评论插入后
comment-updated 评论更新后
comment-deleted 评论删除后
comment-rendered 评论节点渲染后
unreads-updated 未读消息变更时
list-goto 评论跳转时
page-loaded 页面数据更新后
editor-submit 编辑器提交时
editor-submitted 编辑器提交后
user-changed 本地用户数据变更时
conf-loaded 配置变更时
dark-mode-changed 深色模式变更时
sidebar-show 侧边栏显示
sidebar-hide 侧边栏隐藏

事件声明代码:@ArtalkJS/Artalk - types/event.ts

添加事件监听

artalk.on('list-loaded', () => {
  alert('评论已加载完毕')
})

解除事件监听

let foo = function() { /* do something */ }

artalk.on('list-loaded', foo)
artalk.off('list-loaded', foo)