mounted () { window.addEventListener('resize', this.handleResize) }
// 画布尺寸适配 handleResize () { if (!this.graph || this.graph.get('destroyed')) return let container = document.getElementById('container') let height = container.offsetHeight let width = container.offsetWidth if (!width || !height) return this.graph.changeSize(width, height) // 接受两个参数(改变的宽度,高度) },
在用户拖拽浏览器改变大小时,使用 graph.changeSize
参考文章:AntV G6 的坑之—— fitView 适配失败
标签:G6,container,graph,Antv,height,画布,width,let From: https://www.cnblogs.com/rachelch/p/17161616.html