vue打印

https://www.jb51.net/article/147040.htm

https://www.cnblogs.com/steamed-twisted-roll/p/10683680.html

<template>
  <div>
    <div id="printMe" ref="printContent">
      <ul class="content">
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
        <li>轻轻的我走了,</li>
      </ul>
    </div>
    <el-button v-print="printObj" type="primary">直接打印</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      img: require('../../assets/imgUrl/15A.png'),
      printObj: {
        id: 'printMe',
        popTitle: '打印',
        // extraCss: require('../../assets/imgUrl/15A.png'),
        // extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>'
      }
    }
  },
  watch: {
  },

  created() {
  },
  methods: {

  }
}
</script>

 

posted @ 2021-08-10 10:34  zjxgdq  阅读(51)  评论(0编辑  收藏  举报