html2canvas截图

import html2canvas from 'html2canvas'
// 截图
getCapture () {
  html2canvas(this.$refs.rainContent, {
    useCORS: true,
    logging: false
  }).then(canvas => {
    const imageUrl = canvas.toDataURL('image/jpeg', 1)
    this.closeWebPage()
  })
}
// 打开网页
const openWebPage = window.open('/fullscreen', 'SubWindow', 'width=1000,height=600,status=no,menubar=no,toolbar=no,scrollbars=yes')
openWebPage.focus()
// 关闭网页
closeWebPage () {
  if (navigator.userAgent.indexOf('MSIE') > 0) {
    if (navigator.userAgent.indexOf('MSIE 6.0') > 0) {
      window.opener = null
      window.close()
    } else {
      window.open('', '_top')
      window.top.close()
    }
  } else if (navigator.userAgent.indexOf('Firefox') > 0) {
    window.location.href = 'about:blank'
  } else {
    window.opener = null
    window.open('', '_self', '')
    window.close()
  }
}

你可能感兴趣的:(案例,javascript)