//把需要打印的代码,替换掉body中的内容,执行window.print()方法
document.getElementsByTagName("body")[0].style.overflow='auto' // this.$print(this.$refs.print) var arr=document.getElementsByClassName('v-transfer-dom') arr.forEach(function(item){ item.style.display='none' }) var tables=document.getElementsByTagName('table'); tables.forEach(function(item){ item.style.width='100%' item.setAttribute('width','100%'); }) var td=document.getElementsByTagName('td'); td.forEach(function(item){ item.style.width='auto' item.setAttribute('width','auto'); }) setTimeout(function(){ document.getElementById('app1').innerHTML="" document.getElementById('app1').appendChild((document.getElementById('print').cloneNode(true))) window.print(); window.location.reload(); })

 

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2021-12-12
  • 2021-06-09
  • 2021-09-30
  • 2022-12-23
  • 2021-06-13
猜你喜欢
  • 2021-07-09
  • 2021-07-16
  • 2021-11-18
  • 2021-05-13
相关资源
相似解决方案