Skip to content
目录

DrawImage 图片合并

何时使用

  • 多张图片需要合并的时候

代码演示

vue
<script setup>
import { DrawImage } from '@xiaomh/vue3-alan-vite-component';

const reactiveProps = reactive({
  renderList: [
      {
        type: 'image',
        src: '/examples/assets/zj-bg.jpeg',
        width: 500,
        height: 500,
        x: 0,
        y: 0
      },
      {
        type: 'image',
        src: '/examples/assets/hongbao.png',
        clipCircle: true,
        clipLineWidth: 10,
        clipStrokeStyle: '#ffffff',
        width: 60,
        height: 60,
        x: 180,
        y: 20
      },
      {
        type: 'text',
        text: '我的名字我的名字',
        align: 'center',
        fontSize: 20,
        fillStyle: '#333',
        x: 100,
        y: 120
      },
      {
        type: 'image',
        src: '/examples/assets/clock.png',
        width: 80,
        height: 80,
        x: 0,
        y: 150
      }
    ]
})

</script>

<template>
  <DrawImage :renderList="reactiveProps.renderList"></DrawImage>
</template>

<style></style>

<script setup>
import { DrawImage } from '@xiaomh/vue3-alan-vite-component';

const reactiveProps = reactive({
  renderList: [
      {
        type: 'image',
        src: '/examples/assets/zj-bg.jpeg',
        width: 500,
        height: 500,
        x: 0,
        y: 0
      },
      {
        type: 'image',
        src: '/examples/assets/hongbao.png',
        clipCircle: true,
        clipLineWidth: 10,
        clipStrokeStyle: '#ffffff',
        width: 60,
        height: 60,
        x: 180,
        y: 20
      },
      {
        type: 'text',
        text: '我的名字我的名字',
        align: 'center',
        fontSize: 20,
        fillStyle: '#333',
        x: 100,
        y: 120
      },
      {
        type: 'image',
        src: '/examples/assets/clock.png',
        width: 80,
        height: 80,
        x: 0,
        y: 150
      }
    ]
})

</script>

<template>
  <DrawImage :renderList="reactiveProps.renderList"></DrawImage>
</template>

<style></style>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

API

属性说明

属性说明类型默认值版本
width宽度number5001.1.0
height高度number5001.0.0
bl比例number51.0.0
renderList渲染合并的数组Array[]1.0.0

renderList属性说明

属性说明类型默认值版本
type类型 目前: image / textstring-1.0.0
src图片路径如果type是 text 无需传string-1.0.0
clipCircle图片圆形booleanfalse1.0.0
clipLineWidth图片线框宽度number01.0.0
clipStrokeStyle图片圆角样式string-1.0.0
width宽度number-1.0.0
height高度number-1.0.0
xx轴位置number-1.0.0
yy轴位置number-1.0.0
text文本string-1.0.0
align文本对齐方式string-1.0.0
fontSize文本大小number-1.0.0
fillStyle文本样式string-1.0.0

Welcome to the site