Print打印

我是测试字段

<template>
  <el-button type="primary"
             @click="handlePrint">打印全部</el-button>
  <el-button type="primary"
             @click="handlePrint1">打印局部</el-button>
  <el-button type="primary"
             @click="handlePrint2">打印DOM</el-button>
  <div id="test">
    <h2 style="color:red">我是测试字段</h2>
  </div>
</template>
<script>
export default {
  methods: {
    handlePrint () {
      this.$Print('#app');
    },
    handlePrint1 () {
      this.$Print('#test');
    },
    handlePrint2 () {
      this.$Print(document.querySelector('.logo'));
    }
  }
}
</script>
显示代码

Variables

参数说明类型可选值默认值
iddom元素的idString--
htmlhtml代码片段String--
Last Updated:
Contributors: smallwei
您正在浏览基于Avue 3.x文档; 点击这里 查看Avue 2.x 的文档