1 Star 0 Fork 50

zd86 / avue-doc

forked from smallwei / avue-doc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
print.md 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
smallwei 提交于 2020-05-30 20:51 . init docs
<script> export default { methods: { handlePrint1(){ setTimeout(()=>{ this.$Print({ id:'test' }); },1000) }, handlePrint() { setTimeout(()=>{ this.$Print({ html:document.body.innerHTML }); },1000) } } } </script>

Print打印

:::tip 2.5.1+ ::::

  • 进来需要延迟再调用打印

:::demo

<el-button type="primary" @click="handlePrint1" >打印局部</el-button>
<el-button type="primary" @click="handlePrint" >打印全部</el-button>
<div id="test">
  <h2 style="color:red">我是测试字段</h2>
</div>
<script>
export default {
  methods: {
     handlePrint1(){
      setTimeout(()=>{
        this.$Print({
          id:'test'
        });
      },0)
    },
    handlePrint() {
      setTimeout(()=>{
        this.$Print({
          html:document.body.innerHTML
        });
      },0)
    }
  }
}
</script>

:::

Variables

参数 说明 类型 可选值 默认值
id dom元素的id String - -
html html代码片段 String - -
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/86zhangdong/avue-doc.git
git@gitee.com:86zhangdong/avue-doc.git
86zhangdong
avue-doc
avue-doc
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891