File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,24 @@ const {
106106
107107 The properties of current locale have been merged into the root-level properties.
108108
109+ ### onContentUpdated
110+
111+ - Details:
112+
113+ When the content of the markdown file changes, the callback is triggered.
114+
115+ This function can only be called during the ` setup ` phase of the component.
116+
117+ ``` vue
118+ <script setup>
119+ import { onContentUpdated } from 'vuepress/client'
120+
121+ onContentUpdated((reason) => {
122+ console.log(`content updated reason: ${reason}`)
123+ })
124+ </script>
125+ ```
126+
109127## Helpers
110128
111129### defineClientConfig
@@ -126,7 +144,7 @@ const {
126144- Also see:
127145 - [ Advanced > Cookbook > Resolving Routes] ( ../advanced/cookbook/resolving-routes.md )
128146
129- ## resolveRoutePath
147+ ### resolveRoutePath
130148
131149- Details:
132150
Original file line number Diff line number Diff line change @@ -106,6 +106,24 @@ const {
106106
107107 当前 locale 中的配置已经合并到顶层配置中。
108108
109+ ### onContentUpdated
110+
111+ - 详情:
112+
113+ 当 markdown 文件内容发生变化时,触发回调。
114+
115+ 该函数仅能在组件的 ` setup ` 阶段被调用。
116+
117+ ``` vue
118+ <script setup>
119+ import { onContentUpdated } from 'vuepress/client'
120+
121+ onContentUpdated((reason) => {
122+ console.log(`content updated reason: ${reason}`)
123+ })
124+ </script>
125+ ```
126+
109127## 工具函数
110128
111129### defineClientConfig
@@ -126,7 +144,7 @@ const {
126144- 参考:
127145 - [ 深入 > Cookbook > 解析路由] ( ../advanced/cookbook/resolving-routes.md )
128146
129- ## resolveRoutePath
147+ ### resolveRoutePath
130148
131149- 详情:
132150
You can’t perform that action at this time.
0 commit comments