vue3实现canvas图片和div整合下载

图片加载完成事件中完成canvas函数的绘画。引入到图片加载事件所在的文件(父组件)中。新建一个文件放置所要整合的div。下载的图片已经生成div。在setup中的实现函数。
摘要由CSDN通过智能技术生成

在这里插入图片描述
下载的图片已经生成div
在这里插入图片描述
图片加载完成事件中完成canvas函数的绘画

        <el-image
          :src="
            locationIP +
            '/prod-api/get/detection/img/' +
            itemData.img_id +
            '?token=' +
            token
          "
          :load="htmlCanvas(itemData)"
        >
        </el-image>

新建一个文件放置所要整合的div

<template>
  <svg :width="context.elWidth" :height="context.elHeight">
    <foreignObject
      x="0"
      :y="0"
      :height="context.elHeight"
      :width="context.elWidth"
    >
        <div
        style="
          /* background: rgba(255, 255, 255, 1); */
          width: 100%;
         height: 500px;//后来察觉此高度无效
          color: black;
          font-weight: bold;
          font-size: 30px;
          border-radius: 10px;
          box-sizing: border-box;
          /* opacity: 0; */
          /* background:rgba(255, 255, 255, 0.6); */
          padding-bottom: 20px;
          overflow: hidden;
        "
      >
        <div
          style="
            width: 100%;
            background-color: rgba(121,180,242, 0.7);
            height: 80px;
            padding-left: 10px;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            line-height: 80px;
            text-align: center;
            color: #fff;
            display: fle
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值