Skip to content

Commit

Permalink
docs:add global api
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Jan 5, 2023
1 parent bf93c29 commit 3678b7f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export default defineConfig({
{ text: '内部右键菜单', link: '/guide/contextmenu-internal' },
{ text: '自定义右键菜单', link: '/guide/contextmenu-custom' }
]
},
{
text: 'API',
items: [
{ text: '全局API', link: '/guide/api' }
]
}
],
socialLinks: [{
Expand Down
21 changes: 21 additions & 0 deletions docs/guide/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 全局API

## 使用方式

```javascript
import Editor from "@hufe921/canvas-editor"

const instance = new Editor(container, <IElement[]>data, options)
instance.apiName()
```
## destroy
功能:销毁编辑器

用法:
```javascript
instance.destroy()
```

::: warning
仅销毁编辑器dom及相关事件,菜单栏、工具栏、外部变量等需自行处理。
:::

0 comments on commit 3678b7f

Please sign in to comment.