使用插件html2canvas
官网:https://html2canvas.cn/html2canvas-getStart.html
案例:

import { onMounted } from "vue"
import { RouterView } from 'vue-router'
import html2canvas from 'html2canvas'


onMounted(() => {
  html2canvas(document.querySelector(".box")!).then(canvns => {
    document.querySelector(".newBox")?.appendChild(canvns)
  })
})
  <div class="box">
    <!-- <svg> 
      <polygon points="50,0 0,100 100,100"></polygon>
    </svg> -->
    <svg>
      <polyline points="50,0 0,100 100,100 0,-100" fill="none" stroke="#f00" stroke-width="2"></polyline>
    </svg>

  </div>
  <div class="newBox">

  </div>

image.png


hanbo_bo
16 声望1 粉丝

引用和评论

0 条评论