网页开发简历模板,百度推广怎么优化,wordpress文章改背景色,为知笔记 导入wordpress一、Relation-graph
是支持Vue2、Vue3、React的关系数据展示组件#xff0c;支持通过【插槽】让使用者使用普通HTML元素、Vue组件、React组件来完全自定义图形元素#xff0c;并提供实用的API接口让使用者轻松构建可交互的图形应用。
二、网站#xff1a;
Re…一、Relation-graph
是支持Vue2、Vue3、React的关系数据展示组件支持通过【插槽】让使用者使用普通HTML元素、Vue组件、React组件来完全自定义图形元素并提供实用的API接口让使用者轻松构建可交互的图形应用。
二、网站
RelationGraph官网网站快速使用 参数配置参数
三、VUE项目使用
项目中引用relation-graph 安装
## npm 下载npm install --save relation-graph## yarn 下载yarn add relation-graph在Vue 2 中使用 1relation-graph也支持在main.js文件中使用Vue.use(RelationGraph); 2或者直接在vue的script中通过import引用
import RelationGraph from relation-graph四、基础代码示例
templatedivdiv关系图/divdiv styleheight: calc(100vh - 60px)RelationGraphrefgraphRef:optionsgraphOptions:on-node-clickonNodeClick:on-line-clickonLineClick//div/div
/templatescript
import RelationGraph from relation-graph; // 引入组件export default {name: Demo,components: { RelationGraph },data() {return {graphOptions: {defaultJunctionPoint: border,// 这里可以参考Graph 图谱中的参数进行设置 https://www.relation-graph.com/#/docs/graph},};},mounted() {this.showGraph();},methods: {showGraph() {const jsonData {rootId: a,nodes: [{ id: a, text: A, borderColor: yellow },{ id: b, text: B, color: #43a2f1, fontColor: yellow },{ id: c, text: C, nodeShape: 1, width: 80, height: 60 },{ id: e, text: E, nodeShape: 0, width: 150, height: 150 },],lines: [{ from: a, to: b, text: 关系1, color: #43a2f1 },{ from: a, to: c, text: 关系2 },{ from: a, to: e, text: 关系3 },{ from: b, to: e, color: #67C23A },],};// 以上数据中的node和link可以参考Node节点和Link关系中的参数进行配置this.$refs.graphRef.setJsonData(jsonData, (graphInstance) {// Called when the relation-graph is completedconsole.log(graphInstance, graphInstance);});},onNodeClick(nodeObject, $event) {console.log(onNodeClick:, nodeObject);},onLineClick(lineObject, $event) {console.log(onLineClick:, lineObject);},},
};
/script