From 66c9805efce17bd92d47bede880b14cead90aa32 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 26 Jun 2023 10:32:36 +0800 Subject: [PATCH] Doc: update --- index.html | 2 +- web/src/pages/Doc/en/start/index.md | 2 +- web/src/pages/Doc/en/start/index.vue | 2 +- web/src/pages/Doc/zh/course20/index.md | 7 ++++++- web/src/pages/Doc/zh/course20/index.vue | 5 ++++- web/src/pages/Doc/zh/start/index.md | 2 +- web/src/pages/Doc/zh/start/index.vue | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index d4d2eb08..8b4d8856 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -一个简单的web思维导图实现
\ No newline at end of file +一个简单的web思维导图实现
\ No newline at end of file diff --git a/web/src/pages/Doc/en/start/index.md b/web/src/pages/Doc/en/start/index.md index cf7bf663..7531d047 100644 --- a/web/src/pages/Doc/en/start/index.md +++ b/web/src/pages/Doc/en/start/index.md @@ -77,7 +77,7 @@ If you need a file in the format of `umd` module, such as `CDN` in the browser, ``` -A global variable `window.simpleMindMap` will be created. +A global variable `window.simpleMindMap` will be created. you can get `MindMap` constructor by `window.simpleMindMap.default`, for more detail info you can log `window.simpleMindMap`. The disadvantage of this method is that it will contain all the content, including the plugins you have not registered, so the overall volume will be relatively large. diff --git a/web/src/pages/Doc/en/start/index.vue b/web/src/pages/Doc/en/start/index.vue index ae5c83d0..40a59e22 100644 --- a/web/src/pages/Doc/en/start/index.vue +++ b/web/src/pages/Doc/en/start/index.vue @@ -57,7 +57,7 @@ compile this dependency:

<link rel="stylesheet" href="simpleMindMap.css">
 <script scr="simpleMindMap.umd.min.js"></script>
 
-

A global variable window.simpleMindMap will be created.

+

A global variable window.simpleMindMap will be created. you can get MindMap constructor by window.simpleMindMap.default, for more detail info you can log window.simpleMindMap.

The disadvantage of this method is that it will contain all the content, including the plugins you have not registered, so the overall volume will be relatively large.

(v0.5.4+)If you want to use the ES module directly on the browser side, you can find the simpleMindMap.esm.js and simpleMindMap.esm.css files in the /simple-mind-map/dist/ directory.

Development

diff --git a/web/src/pages/Doc/zh/course20/index.md b/web/src/pages/Doc/zh/course20/index.md index bbe61ec4..19851e13 100644 --- a/web/src/pages/Doc/zh/course20/index.md +++ b/web/src/pages/Doc/zh/course20/index.md @@ -2,7 +2,7 @@ > 该特性v0.6.3+版本支持 -如果你想自定义节点的内容,那么可以在实例化`simple-mind-map`时传入一下选项: +如果你想自定义节点的内容,那么可以在实例化`simple-mind-map`时传入以下选项: ```js new MindMap({ @@ -23,6 +23,8 @@ node.nodeData.data `customCreateNodeContent`方法需要返回`DOM`节点,如果某个节点你不想自定义,那么可以返回`null`,那么还是会走内置的节点渲染逻辑。 +返回的`DOM`节点的宽高需要是确定的,如果是动态的那么会导致宽高获取错误,最终导致节点定位错误和发生重叠等问题。 + 如果使用了自定义节点内容,那么内置的插入节点内容的相关方法你都不应该再使用,因为相当于整个节点内容都由你自己控制,另外,节点样式设置也不会再生效,切换主题也只会切换非节点内容的样式,最后,双击节点也不会再进入编辑,所以这个功能一般用于展示性的需求。 ## 示例1:渲染自定义DOM节点 @@ -112,3 +114,6 @@ import CustomNodeContent from './CustomNodeContent.vue' } ``` +## 示例4:渲染react组件 + +如果你成功渲染了`react`组件,欢迎[提交](https://github.com/wanglin2/mind-map/issues/new)示例代码给我~ \ No newline at end of file diff --git a/web/src/pages/Doc/zh/course20/index.vue b/web/src/pages/Doc/zh/course20/index.vue index 482e42ae..e57bc24a 100644 --- a/web/src/pages/Doc/zh/course20/index.vue +++ b/web/src/pages/Doc/zh/course20/index.vue @@ -4,7 +4,7 @@

该特性v0.6.3+版本支持

-

如果你想自定义节点的内容,那么可以在实例化simple-mind-map时传入一下选项:

+

如果你想自定义节点的内容,那么可以在实例化simple-mind-map时传入以下选项:

new MindMap({
     isUseCustomNodeContent: true,
     customCreateNodeContent: (node) => {
@@ -17,6 +17,7 @@
 

其他节点实例属性你可以自行打印出来看看。

customCreateNodeContent方法需要返回DOM节点,如果某个节点你不想自定义,那么可以返回null,那么还是会走内置的节点渲染逻辑。

+

返回的DOM节点的宽高需要是确定的,如果是动态的那么会导致宽高获取错误,最终导致节点定位错误和发生重叠等问题。

如果使用了自定义节点内容,那么内置的插入节点内容的相关方法你都不应该再使用,因为相当于整个节点内容都由你自己控制,另外,节点样式设置也不会再生效,切换主题也只会切换非节点内容的样式,最后,双击节点也不会再进入编辑,所以这个功能一般用于展示性的需求。

示例1:渲染自定义DOM节点

{
@@ -92,6 +93,8 @@
     }
 }
 
+

示例4:渲染react组件

+

如果你成功渲染了react组件,欢迎提交示例代码给我~

diff --git a/web/src/pages/Doc/zh/start/index.md b/web/src/pages/Doc/zh/start/index.md index 97087456..8d3ce04f 100644 --- a/web/src/pages/Doc/zh/start/index.md +++ b/web/src/pages/Doc/zh/start/index.md @@ -72,7 +72,7 @@ const mindMap = new MindMap({ ``` -会创建一个全局变量`window.simpleMindMap`。 +会创建一个全局变量`window.simpleMindMap`,可以通过`window.simpleMindMap.default`获取到`MindMap`构造函数,详细信息可以把`window.simpleMindMap`打印出来看一下。 这种方式的缺点是会包含所有的内容,包括你没有注册的插件,所以整体体积会比较大。 diff --git a/web/src/pages/Doc/zh/start/index.vue b/web/src/pages/Doc/zh/start/index.vue index 826934db..c1a26a82 100644 --- a/web/src/pages/Doc/zh/start/index.vue +++ b/web/src/pages/Doc/zh/start/index.vue @@ -51,7 +51,7 @@
<link rel="stylesheet" href="simpleMindMap.css">
 <script scr="simpleMindMap.umd.min.js"></script>
 
-

会创建一个全局变量window.simpleMindMap

+

会创建一个全局变量window.simpleMindMap,可以通过window.simpleMindMap.default获取到MindMap构造函数,详细信息可以把window.simpleMindMap打印出来看一下。

这种方式的缺点是会包含所有的内容,包括你没有注册的插件,所以整体体积会比较大。

(v0.5.4+)如果你想直接在浏览器端通过ES模块的方式来使用,你可以在/simple-mind-map/dist/目录中找到simpleMindMap.esm.jssimpleMindMap.esm.css文件。

开发