欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

思維導(dǎo)圖插件jsMind的詳細(xì)使用指南

 更新時(shí)間:2024年07月08日 09:20:09   作者:向小江  
jsMind是一個顯示/編輯思維導(dǎo)圖的純的javascript類庫,其基于HTML5的帆布進(jìn)行設(shè)計(jì).jsMind以BSD協(xié)議開源,這篇文章主要給大家介紹了關(guān)于思維導(dǎo)圖插件jsMind的詳細(xì)使用指南,需要的朋友可以參考下

1、下載jsMind

npm install jsMind --s

2、在需要使用的頁面 引入css樣式和js方法

import "jsmind/style/jsmind.css";
import jsMind from "jsmind/js-legacy/jsmind.js";

3、初始化jsMind

export default {
  data() {
    return {
      mind: {
        /* 元數(shù)據(jù),定義思維導(dǎo)圖的名稱、作者、版本等信息 */
        meta: {
          name: "思維導(dǎo)圖",
          author: "",
          version: "0.2",
        },
        /* 數(shù)據(jù)格式聲明 */
        format: "node_tree",
        /* 數(shù)據(jù)內(nèi)容 */
        data: {
          id: "root",
          topic: "jsMind",
          children: [
            {
              id: "easy", // [必選] ID, 所有節(jié)點(diǎn)的ID不應(yīng)有重復(fù),否則ID重復(fù)的結(jié)節(jié)將被忽略
              topic: "Easy", // [必選] 節(jié)點(diǎn)上顯示的內(nèi)容
              direction: "right", // [可選] 節(jié)點(diǎn)的方向,此數(shù)據(jù)僅在第一層節(jié)點(diǎn)上有效,目前僅支持 left 和 right 兩種,默認(rèn)為 right
              // expanded: false, // [可選] 該節(jié)點(diǎn)是否是展開狀態(tài),默認(rèn)為 true
              children: [
                {
                  id: "easy8",
                  topic: "Easy to show",
                  children: [
                    { id: "open7", topic: "on GitHub" },
                    { id: "easy7", topic: "Easy to embed" },
                  ],
                },
                { id: "easy2", topic: "Easy to edit" },
                { id: "easy3", topic: "Easy to store" },
                { id: "easy4", topic: "Easy to embed" },
              ],
            },
            {
              id: "open",
              topic: "Open Source",
              direction: "right",
              // expanded: false,
              children: [
                { id: "open1", topic: "on GitHub" },
                { id: "open2", topic: "BSD License" },
              ],
            },

            {
              id: "powerful",
              topic: "Powerful",
              direction: "right",
              // expanded: false,

              children: [
                { id: "powerful1", topic: "Base on Javascript" },
                { id: "powerful2", topic: "Base on HTML5" },
                { id: "powerful3", topic: "Depends on you" },
              ],
            },
            {
              id: "other",
              topic: "test node",
              direction: "right",
              // expanded: false,

              children: [
                { id: "other1", topic: "I'm from local variable" },
                { id: "other2", topic: "I can do everything" },
              ],
            },
          ],
        },
      },
      options: {
        container: "jsmind_container", // [必選] 容器的ID
        editable: true, // [可選] 是否啟用編輯
        theme: "primary", // [可選] 主題
        view: {
          engine: "canvas", // 思維導(dǎo)圖各節(jié)點(diǎn)之間線條的繪制引擎
          hmargin: 20, // 思維導(dǎo)圖距容器外框的最小水平距離
          vmargin: 20, // 思維導(dǎo)圖距容器外框的最小垂直距離
          line_width: 2, // 思維導(dǎo)圖線條的粗細(xì)
          line_color: "#ddd", // 思維導(dǎo)圖線條的顏色
          hide_scrollbars_when_draggable: true,
        },
        layout: {
          hspace: 100, // 節(jié)點(diǎn)之間的水平間距
          vspace: 20, // 節(jié)點(diǎn)之間的垂直間距
          pspace: 20, // 節(jié)點(diǎn)與連接線之間的水平間距(用于容納節(jié)點(diǎn)收縮/展開控制器)
        },
        shortcut: {
          enable: false, // 是否啟用快捷鍵 默認(rèn)為true
        },
        // editableDrag:true,
        // get_selected_node:function(val){
        //     this.selectedNode=val
        // }
      },
      jm: "",
      selectedNode: "",
      newNodeId: 1,
    };
  },
  mounted() {
    // 初始化
    this.jm = new jsMind(this.options);
    //渲染canvas
    this.jm.show(this.mind);
  },
};

4、頁面綁定dom

 <div id="jsmind_container"></div>

5、效果圖

6、內(nèi)置方法

獲取節(jié)點(diǎn)

獲取根節(jié)點(diǎn) :  this.jm.get_root()

根據(jù) id 查找節(jié)點(diǎn) : this.jm.get_node(nodeid)

獲取選中的節(jié)點(diǎn) : this.jm.get_selected_node()

查找相鄰的上一個節(jié)點(diǎn) : this.jm.find_node_before(node|nodeid) 

查找相鄰的下一個節(jié)點(diǎn) : this.jm.find_node_after(node|nodeid)

操作節(jié)點(diǎn)

選中節(jié)點(diǎn) : this.jm.select_node(node)

收起子節(jié)點(diǎn) : this.jm.collapse_node(node|nodeid)

展開子節(jié)點(diǎn) : this.jm.expand_node(node|nodeid)

收起或展開子節(jié)點(diǎn) :this.jm.toggle_node(node|nodeid) 方法可自動展開或收起子節(jié)點(diǎn)。

展開全部子節(jié)點(diǎn) : this.jm.expand_all()

展開至指定層級 : this.jm.expand_to_depth(depth)

移動節(jié)點(diǎn) :  this.jm.move_node(node|nodeid,beforeid)

啟用編輯 : this.jm.enable_edit()

禁止編輯 : this.jm.disable_edit()

調(diào)整節(jié)點(diǎn)為編輯狀態(tài) : this.jm.begin_edit(node|nodeid)

調(diào)整節(jié)點(diǎn)為只讀狀態(tài) : this.jm.end_edit(node|nodeid)

加減節(jié)點(diǎn)

添加節(jié)點(diǎn) : this.jm.add_node(parent_node, nodeid, topic, data)

在指定位置前插入節(jié)點(diǎn) : this.jm.insert_node_before(node_before, nodeid, topic)

在指定位置后插入節(jié)點(diǎn) :  this.jm.insert_node_after(node_after, nodeid, topic)

刪除節(jié)點(diǎn)及其子節(jié)點(diǎn) : this.jm.remove_node(node|nodeid)

更新節(jié)點(diǎn)topic顯示內(nèi)容 : this.jm.update_node(nodeid, topic)

獲取數(shù)據(jù)

獲取元數(shù)據(jù) :this.jm.get_meta() 。

獲取指定格式的思維導(dǎo)圖數(shù)據(jù) : this.jm.get_data(data_format)

設(shè)置樣式

設(shè)置主題 : this.jm.set_theme(theme)

設(shè)置背景色/前景色 : this.jm.set_node_color(nodeid, bgcolor, fgcolor)

設(shè)置字體 : this.jm.set_node_font_style(nodeid, size, weight, style)

設(shè)置背景圖片 : this.jm.set_node_background_image(nodeid, image, width, height)

其他操作

清除節(jié)點(diǎn)的選中 : this.jm.select_clear() 。

判斷節(jié)點(diǎn)是否可見 :  this.jm.is_node_visible(node)

總結(jié)

到此這篇關(guān)于思維導(dǎo)圖插件jsMind的詳細(xì)使用指南的文章就介紹到這了,更多相關(guān)思維導(dǎo)圖插件jsMind內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論