feige
2023-09-10 8319f67b9bec1d19c06eaa4216f0f34c67e3afb1
ruoyi-ui/src/views/components/superMindmap.vue
@@ -3,7 +3,7 @@
</template>
<script>
    import * as d3 from 'd3';
    export default {
        props: {
            data: Object,
@@ -281,7 +281,7 @@
            },
        },
    }
    // 获取树的深度
    function getDepth(json) {
        var arr = [];
@@ -306,7 +306,7 @@
        }
        return depth;
    }
    // 提取树的子节点,最终所有树的子节点都会存入传入的leafList数组中
    function getTreeLeaf(treeData, leafList) {
        // 判断是否为数组
@@ -326,13 +326,13 @@
            }
        }
    }
    // 获取包含汉字的字符串的长度
    function getStringSizeLength(string) {
        //先把中文替换成两个字节的英文,再计算长度
        return string.replace(/[\u0391-\uFFE5]/g, "aa").length;
    }
    // 生成随机的字符串
    function randomString(strLength) {
        strLength = strLength || 32;
@@ -343,7 +343,7 @@
        }
        return n
    }
    // 获取字符串的像素宽度
    function getPXwidth(str, fontSize = "12px", fontFamily = "Microsoft YaHei") {
        var span = document.createElement("span");
@@ -365,4 +365,4 @@
        // result.height = parseFloat(window.getComputedStyle(span).height) - result.height;
        return result.width;
    }
</script>
</script>