# vue2-drawboard
## Introduction
This is a drawboard tool based on vue2.x and canvas. Through this tool you can mark the information you want on a picture and get the corresponding data. In addition, you can also use it as an ordinary drawboard, where you can freely draw graphics on it. The currently supported types are polyline, rectangle, polygon, point, etc. Can support zoom in, zoom out, rotation, translation and other operations.Besides, you can flexibly configure your drawing information.
## Installation
```sh
npm install vue2-drawboard -S
```
## Usage
```js
import DrawBoard from 'vue2-drawboard'
import 'vue2-drawboard/lib/drawboard.css'
Vue.use(DrawBoard);
```
## Example
```vue
<template>
<div id="app">
<drawboard :url="url" @updateData="updateData" @drawEventDone="drawEventDone"></drawboard>
</div>
</template>
<script>
export default {
name: 'App',
data() {
return {
url:'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
}
},
methods:{
updateData(data){
console.log(data);
},
drawEventDone() {
console.log("well done!");
}
}
}
</script>
```
## Options
### url
+ Type: String
+ Required: True
>The URL of the image to be edited.
### labelDataOrigin
+ Type: Array
+ Required: False
>Render graphics based on input data.The format of the data is as follows
```json
[
{
"type":"rectangle",
"points":[
{"x":228,"y":240},
{"x":287,"y":240},
{"x":287,"y":286},
{"x":228,"y":286}
],
"options":{
"path_lineWidth":"4",
"path_strokeStyle":"#f00",
"point_radis":"5", // Judge whether to select the point when clicking
"point_lineWidth":"2",
"point_strokeStyle":"#999" // The color of the point when selected
}
},
{
"type":"rectangle",
"points":[
{"x":402,"y":214},
{"x":438,"y":214},
{"x":438,"y":249},
{"x":402,"y":249}
],
"options":{
"path_lineWidth":"4",
"path_strokeStyle":"#f00",
"point_radis":"5", // Judge whether to select the point when clicking
"point_lineWidth":"2",
"point_strokeStyle":"#999" // The color of the point when selected
}
}
]
```
### userOptions
+ Type: Object
+ Required: False
+ default: {}
> You can configure the drawing parameters by this variable.The parameter form is the same as the options in labelDataOrigin above.
### loadingData
+ Type: Boolean
+ Required: False
+ default: False
> You can control whether to display the image loading animation.
### updateData
+ Type: Function
+ Required: True
> Through this method you can get the labeled data.
### drawEventDone
+ Type: Function
+ Required: False
> Through this method you can do what you want when finish drawing.
### deleteFigureCb
+ Type: Function
+ Required: False
> This is a callback function after deleting an item, and parameter is the index value of the deleted item
### clearAllCb
+ Type: Function
+ Required: False
> This is a callback function after clear the drawboard.
### activeIndexChange
+ Type: Function
+ Required: False
> This is a callback function after changing active index.
### hot key
|hot key|Feature|
|:----|:----|
|ctrl+scroll|zoomIn/zoomOut|
|Right click|move|
## Keywords
Drawboard canvas Vue2.x Data-labeling
没有合适的资源?快使用搜索试试~ 我知道了~
vue2-drawboard:基于vue2.x的画板
共33个文件
js:12个
vue:4个
scss:3个
5星 · 超过95%的资源 需积分: 50 14 下载量 152 浏览量
2021-05-26
03:41:36
上传
评论
收藏 1.04MB ZIP 举报
温馨提示
vue2画板 介绍 这是基于vue2.x和canvas的绘图板工具。 通过此工具,您可以在图片上标记所需的信息并获取相应的数据。 此外,您还可以将其用作普通绘图板,在其中可以自由在其上绘制图形。 当前支持的类型为折线,矩形,多边形,点等。可以支持放大,缩小,旋转,平移和其他操作。此外,您还可以灵活地配置图形信息。 安装 npm install vue2-drawboard -S 用法 import DrawBoard from 'vue2-drawboard' import 'vue2-drawboard/lib/drawboard.css' Vue . use ( DrawBoard ) ; 例子 < template> < div xss=removed> < drawboard : url = " url " @ updateData = " updateData
资源详情
资源评论
资源推荐
收起资源包目录
vue2-drawboard-main.zip (33个子文件)
vue2-drawboard-main
vue.config.js 288B
package.json 933B
package-lock.json 450KB
.npmignore 279B
examples
App.vue 402B
main.js 197B
.gitignore 236B
lib
drawboard.common.js.map 829KB
drawboard.common.js 652KB
drawboard.umd.min.js 239KB
drawboard.umd.js.map 829KB
fonts
element-icons.732389de.ttf 55KB
element-icons.535877f5.woff 28KB
drawboard.umd.min.js.map 984KB
demo.html 188B
drawboard.umd.js 653KB
drawboard.css 58KB
public
index.html 613B
favicon.ico 4KB
README.md 3KB
packages
DrawBoard
index.js 618B
draw
index.js 2KB
imageEvent.js 4KB
figureFactory.js 6KB
main.vue 23KB
components
topBar.vue 6KB
tool.vue 1KB
styles
drawboard.scss 950B
index.scss 833B
variables.scss 588B
utils
index.js 6KB
index.js 578B
babel.config.js 219B
共 33 条
- 1
可爱的小树懒
- 粉丝: 16
- 资源: 4577
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1