Vue中的客户端图像编辑–vue-image-markup

Vue中的客户端图像编辑–vue-image-markup

插件名称:vue-image-markup

发布时间:2020年8月14日

插件作者:lionix-team

官网 演示 GitHub下载

图像标记是一种客户端图像编辑组件,可让您裁剪图像并在图像上绘制文本,形状和笔触。

变更日志:

2020年9月3日

  • 修复setTool(selectMode)错误

安装和下载:

# Yarn
$ yarn add vue-image-markup

# NPM
$ npm i vue-image-markup --save

基本用法:

1.导入图像标记。

import Editor from 'vue-image-markup';

2.将图像标记添加到应用程序。

<Editor :canvasWidth="Width" :canvasHeight="Height" ref="editor" :editorId="1" />

3.启用编辑模式:

  • 文本
  • 直肠
  • 选择模式
  • 箭头
  • freeDrawing
  • 作物
mounted() {
  $this.$refs.editor.set(this.editor.mode,this.editor.options);
}

4.方法。

// 设置图片
this.$refs.editor.uploadImage(e)

// 保存图片为base64格式
this.$refs.editor.saveImage()

// 清除
this.$refs.editor.clear()

// 撤销
this.$refs.editor.undo()

// 重做
this.$refs.editor.redo()

// 按id获取对象
this.$refs.editor.getObjectsById('title')
相关插件