vueflow截图功能,线会有黑色背景,解决办法,画线时style里设置fill:‘none’
// 线的默认颜色
const edgesStyle = {style: {fill:'none',stroke: '#6366f1',strokeWidth: 1, // 设置线宽 },markerEnd: {type: MarkerType.ArrowClosed,// color: '#6366f1',// width: 6, // 箭头宽度// height: 12, // 箭头高度}
}
// 链接线
onConnect((connection) => {addEdges({...connection, // 保留原始连接属性...edgesStyle})
})
function doScreenshot() {//截图if (!vueFlowRef.value) {console.warn('VueFlow element not found');return;}capture(vueFlowRef.value, { shouldDownload: true });
}
修改前
修改后