Giter VIP home page Giter VIP logo

Comments (4)

wanglin2 avatar wanglin2 commented on May 23, 2024

代码截一下,看视频我也不知道为啥

from mind-map.

yangda666 avatar yangda666 commented on May 23, 2024
<template>
  <el-dialog class="nodeImportDialog" title="预览" :visible.sync="dialogVisible" width="800px">
    <div id="mindMapContainer1" ref="mindMapContainerRef"></div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">{{ $t('dialog.cancel') }}</el-button>
    </span>
  </el-dialog>
</template>

<script>

import { getData } from '@/api';
import MindMap from 'simple-mind-map';

export default {
  name: 'Import',
  data() {
    return {
      dialogVisible: false,
      mindMapData: null,
    }
  },
  watch: {
    dialogVisible(val, oldVal) {
      if (val) {
        setTimeout(() => {
          this.getData()
          this.init()
        }, 100)

      }
    }
  },
  created() {
    this.$bus.$on('showPreview', this.handleShowPreview)
  },
  mounted() {
    this.getData()
  },
  beforeDestroy() {
    this.$bus.$off('showPreview', this.handleShowPreview)
  },
  methods: {
    getData() {
      let storeData = getData()
      this.mindMapData = storeData
    },

    handleClose() {
      this.dialogVisible = false
    },
    handleShowPreview() {
      this.dialogVisible = true
    },
    /**
    * @Author: 王林
    * @Date: 2021-04-10 15:01:01
    * @Desc: 初始化
    */
    init() {
      let { root, layout, theme, view, config } = this.mindMapData
      // 如果url中存在要打开的文件,那么思维导图数据、主题、布局都使用默认的
      this.mindMap = new MindMap({
        el: this.$refs.mindMapContainerRef,
        data: root,
        fit: false,
        layout: layout,
        theme: theme.template,
        themeConfig: theme.config,
        viewData: view,
        nodeTextEditZIndex: 1000,
        nodeNoteTooltipZIndex: 1000,
        ...(config || {}),
        // useLeftKeySelectionRightKeyDrag: this.useLeftKeySelectionRightKeyDrag,
        customInnerElsAppendTo: null,
        enableAutoEnterTextEditWhenKeydown: true,
        defaultNodeImage: require('../../../assets/img/图片加载失败.svg'),
        initRootNodePosition: ['center', 'center'],
      })
    },

  },
}


</script>

<style lang="less" scoped>
.nodeImportDialog {
  #mindMapContainer1 {
    // position: absolute;
    width: 100%;
    height: 600px;
  }
}
</style>

from mind-map.

wanglin2 avatar wanglin2 commented on May 23, 2024

是个bug,下个版本会修复

from mind-map.

wanglin2 avatar wanglin2 commented on May 23, 2024

已修复,v0.9.11+生效,也可以拉取feature分支获取最新的代码

from mind-map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.