mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
打包0.6.3
This commit is contained in:
parent
bdb6078df6
commit
060a448cd5
File diff suppressed because one or more lines are too long
@ -37,7 +37,7 @@ node.nodeData.data
|
||||
<h1>我是自定义节点</h1>
|
||||
${ node.nodeData.text }
|
||||
`
|
||||
return dev
|
||||
return div
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -96,3 +96,19 @@ import i18n from './i18n'
|
||||
|
||||
## 示例3:渲染Vue3组件
|
||||
|
||||
```js
|
||||
import { createApp } from "vue"
|
||||
import CustomNodeContent from './CustomNodeContent.vue'
|
||||
|
||||
{
|
||||
customCreateNodeContent: (node) => {
|
||||
let el = document.createElement('div')
|
||||
const app = createApp(CustomNodeContent, {// props
|
||||
html: node.nodeData.data.text
|
||||
})
|
||||
app.mount(el)
|
||||
return el
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<h1>我是自定义节点</h1>
|
||||
<span class="hljs-subst">${ node.nodeData.text }</span>
|
||||
`</span>
|
||||
<span class="hljs-keyword">return</span> dev
|
||||
<span class="hljs-keyword">return</span> div
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
@ -78,6 +78,20 @@
|
||||
}
|
||||
</code></pre>
|
||||
<h2>示例3:渲染Vue3组件</h2>
|
||||
<pre class="hljs"><code><span class="hljs-keyword">import</span> { createApp } <span class="hljs-keyword">from</span> <span class="hljs-string">"vue"</span>
|
||||
<span class="hljs-keyword">import</span> CustomNodeContent <span class="hljs-keyword">from</span> <span class="hljs-string">'./CustomNodeContent.vue'</span>
|
||||
|
||||
{
|
||||
<span class="hljs-attr">customCreateNodeContent</span>: <span class="hljs-function">(<span class="hljs-params">node</span>) =></span> {
|
||||
<span class="hljs-keyword">let</span> el = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">'div'</span>)
|
||||
<span class="hljs-keyword">const</span> app = createApp(CustomNodeContent, {<span class="hljs-comment">// props</span>
|
||||
<span class="hljs-attr">html</span>: node.nodeData.data.text
|
||||
})
|
||||
app.mount(el)
|
||||
<span class="hljs-keyword">return</span> el
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -300,7 +300,7 @@ export default {
|
||||
...(config || {}),
|
||||
iconList: icon,
|
||||
useLeftKeySelectionRightKeyDrag: this.useLeftKeySelectionRightKeyDrag,
|
||||
isUseCustomNodeContent: false,
|
||||
// isUseCustomNodeContent: true,
|
||||
// 示例1:组件里用到了router、store、i18n等实例化vue组件时需要用到的东西
|
||||
// customCreateNodeContent: (node) => {
|
||||
// let el = document.createElement('div')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user