DemuMesDataV/src/plugins/canvasExtend.js

24 lines
399 B
JavaScript
Raw Normal View History

2018-12-07 15:50:10 +08:00
export function drawLine (ctx, lineBegin, lineEnd, lineWidth = 2, lineColor = '#000') {
if (!ctx || !lineBegin || !lineEnd) return
ctx.beginPath()
ctx.moveTo(...lineBegin)
ctx.lineTo(...lineEnd)
ctx.closePath()
ctx.lineWidth = lineWidth
ctx.strokeStyle = lineColor
ctx.stroke()
}
const canvas = {
drawLine
}
export default function (Vue) {
Vue.prototype.canvas = canvas
}