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 });
}
修改前
修改后