使用svg实现鼠标拖动绘制箭头
<template>
<div id="svgMain">
<svg version="1.1"
id="container"
width="900" height="600" style="border:1px solid #000;position: absolute;left: 50px;top: 50px;"
xmlns:svg="http://www.w3.org/2000/svg"
xml:space="preserve"
>
</svg>
<div>
<button @click="drawArrow()">箭头</button>
</div>
</div>
</template>
export default {
data(){
return {
groupId: 1,
lineWidth: 3,
}
},
method:{
drawArrow() {
let _this = this;
let svg = document.getElementById('container')
svg.onmousedown =