最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue打印插件vue-print-nb的實(shí)現(xiàn)代碼

 更新時間:2022年03月17日 10:26:16   作者:你猜我為啥禿頭  
這篇文章主要介紹了vue打印插件vue-print-nb的實(shí)現(xiàn),需要引入插件npm install vue-print-nb --save,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

1.引入插件npm install vue-print-nb --save

在main.js中引入

import Print from 'vue-print-nb'Vue.use(Print)

2.html代碼

<div class="box">
    <div id="printTest" class="upTable">
      <table>
        <tr>
          <td class="title" colspan="4">木材檢尺報(bào)告書</td>
        </tr>
        <tr>
          <td class="one">船名</td>
          <td style="width:190px">{{ goods.shipName }}</td>
          <td class="one">輸出國</td>
          <td>{{ goods.exportCountry }}</td>
        </tr>
        <tr>
          <td class="one">樹種</td>
          <td>{{ variety }}</td>
          <td class="one">委托方/貨主</td>
          <td>{{ goods.goodsMaster }}</td>
        </tr>
        <tr>
          <td class="one">申報(bào)材積</td>
          <td>{{ goods.declareWoodVolume }}立方米</td>
          <td class="one">申報(bào)數(shù)量</td>
          <td>{{ goods.declareNumber }}根</td>
        </tr>
        <tr>
          <td class="one">存放地點(diǎn)</td>
          <td>{{ goods.goodsYard }}</td>
          <td class="one">卸畢時間</td>
          <td v-if="goods.unloadTime">{{ goods.unloadTime.substring(0,10) }}</td>
          <td v-else />
        </tr>
        <tr>
          <td class="one">檢驗(yàn)標(biāo)準(zhǔn)</td>
          <td colspan="3">GB/T 144-2013 國家標(biāo)準(zhǔn)</td>
        </tr>
        <tr>
          <td class="title2" colspan="4">檢驗(yàn)結(jié)果</td>
        </tr>
      </table>
      <table class="dataTable">
        <tr>
          <td style="width:210px">垛位號</td>
          <td style="width:100px">長度</td>
          <td style="width:100px">已檢整木</td>
          <td style="width:100px">材積</td>
          <td style="width:100px">斷木</td>
          <td style="width:0">未檢整木</td>
        </tr>
        <tr v-for="(item,index) in shortData" :key="index">
          <td>{{ item.placeNumber }}</td>
          <td>{{ item.placeLength }}</td>
          <td>{{ item.zs }}</td>
          <td>{{ item.woodVolume }}</td>
          <td>{{ item.damagedWood }}</td>
          <td>{{ item.notCheckWood }}</td>
        </tr>
        <tr>
          <td style="width:210px">合計(jì)</td>
          <td style="width:100px" />
          <td style="width:100px">{{ zsAll }}</td>
          <td style="width:100px">{{ woodVolumeAll }}</td>
          <td style="width:100px">{{ damagedWoodAll }}</td>
          <td style="width:0px">{{ notCheckWoodAll }}</td>
        </tr>
      </table>
    </div>
    <el-button v-print="'#printTest'" type="primary" style="margin-top:20px">
      打印
    </el-button>
  </div>

3.js代碼

<script>
export default {
  props: ['catList', 'goods'],
  data() {
    return {
    //和下邊 <style media="printTest"> 一起的作用是去掉頁眉頁腳、去掉多出空白頁的問題
      printObj: {
        id: 'printTest',
        popTitle: '',
        ectraHead: ''
      },
      shortData: [],
      variety: '',
      zsAll: 0, // 已檢整木  總數(shù)
      woodVolumeAll: 0, // 材積
      damagedWoodAll: 0, // 斷木
      notCheckWoodAll: 0, // 未檢整木
      updateTime: ''
    }
  },
  methods: {
  //這里的數(shù)據(jù)是在父頁面?zhèn)鱽淼?
    getvariety(variety, catList, goods) {
      this.variety = variety
      this.shortData = catListthis.goods = goods// 合計(jì)
      let zsAll = 0
      let woodVolumeAll = 0
      let damagedWoodAll = 0
      let notCheckWoodAll = 0
      this.shortData.map((item) => {
        zsAll += item.zs
        woodVolumeAll += item.woodVolume
        damagedWoodAll += item.damagedWood
        notCheckWoodAll += item.notCheckWood
      })
      this.zsAll = zsAll
      this.woodVolumeAll = woodVolumeAll
      this.damagedWoodAll = damagedWoodAll
      this.notCheckWoodAll = notCheckWoodAll
    },
  }
}
</script>

4.樣式

<style media="printTest">
@page {
    size: auto;
    margin: 3mm;
  }

  html {
    background-color: #ffffff;
    height: auto;
    margin: 0px;
  body {
    border: solid 1px #ffffff;
    margin: 10mm 15mm 10mm 15mm;
</style>
<style lang="less" scoped>
.upTable{
    width: 100%;
    height: 50%;
    margin-top: 10px;
    table{
        width: 100%;
        border-collapse:collapse
    }
    td{
        border: 1px solid #000;
        font-size: 18px;
        text-align: center;
        font-family: Source Han Sans CN;
        font-weight: 450;
        color: #000000;
    .title{
        font-size: 20px;
        height: 50px;
        font-weight: 550;
    .one{
        width: 20%;
        height: 40px;
    .title2{
        height: 45px;
    .dataTable{
        border-top: 0px solid #000000;
        td{
            //  border: 1px solid #000;
            font-size: 18px;
            text-align: center;
            font-family: Source Han Sans CN;
            font-weight: 450;
            color: #000000;
            padding: 5px 0;
        }
}
.el-button{
    margin-right: 20px;
    margin-left: 20px;
    width: 100px;
    padding: 12px 0;

到此這篇關(guān)于vue打印插件vue-print-nb的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)vue打印插件vue-print-nb內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 解決vue router使用 history 模式刷新后404問題

    解決vue router使用 history 模式刷新后404問題

    這篇文章主要介紹了解決vue router使用 history 模式刷新后404問題,需要的朋友可以參考下
    2017-07-07
  • Vue.js特性Scoped Slots的淺析

    Vue.js特性Scoped Slots的淺析

    這篇文章主要介紹了Vue.js特性Scoped Slots的淺析,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-02-02
  • vue跳轉(zhuǎn)頁簽傳參并查詢參數(shù)的保姆級教程

    vue跳轉(zhuǎn)頁簽傳參并查詢參數(shù)的保姆級教程

    這篇文章主要介紹了vue跳轉(zhuǎn)頁簽傳參并查詢參數(shù)的保姆級教程,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-04-04
  • 關(guān)于vue中@click.native.prevent的說明

    關(guān)于vue中@click.native.prevent的說明

    這篇文章主要介紹了關(guān)于vue中@click.native.prevent的說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • Vue3中事件總線的具體使用

    Vue3中事件總線的具體使用

    本文主要介紹了Vue3中事件總線的具體使用,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-04-04
  • vue使用原生swiper代碼實(shí)例

    vue使用原生swiper代碼實(shí)例

    這篇文章主要介紹了vue使用原生swiper代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-02-02
  • 詳解Vue3中ref和reactive函數(shù)的使用

    詳解Vue3中ref和reactive函數(shù)的使用

    這篇文章主要為大家詳細(xì)介紹了Vue3中ref和reactive函數(shù)的使用教程,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)Vue有一定的幫助,需要的可以參考一下
    2022-07-07
  • 談?wù)勎以趘ue-cli3中用預(yù)渲染遇到的坑

    談?wù)勎以趘ue-cli3中用預(yù)渲染遇到的坑

    這篇文章主要介紹了談?wù)勎以趘ue-cli3中用預(yù)渲染遇到的坑,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-04-04
  • 淺析vue-router jquery和params傳參(接收參數(shù))$router $route的區(qū)別

    淺析vue-router jquery和params傳參(接收參數(shù))$router $route的區(qū)別

    今天做項(xiàng)目時踩到了vue-router傳參的坑(jquery和params),所以決定總結(jié)一下二者的區(qū)別。感興趣的朋友跟隨腳本之家小編一起看看吧
    2018-08-08
  • vue父組件監(jiān)聽子組件數(shù)據(jù)更新方式(hook)

    vue父組件監(jiān)聽子組件數(shù)據(jù)更新方式(hook)

    這篇文章主要介紹了vue父組件監(jiān)聽子組件數(shù)據(jù)更新方式(hook),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08

最新評論

邯郸市| 泾源县| 宁安市| 调兵山市| 井研县| 柳江县| 始兴县| 大同市| 万州区| 射阳县| 阿坝| 安多县| 南乐县| 崇阳县| 正镶白旗| 澄城县| 广平县| 平山县| 大名县| 正蓝旗| 大庆市| 东乌珠穆沁旗| 冀州市| 青铜峡市| 宁波市| 南城县| 周宁县| 昌邑市| 翼城县| 裕民县| 南溪县| 隆回县| 长武县| 原阳县| 晋宁县| 留坝县| 湘潭县| 高雄市| 长武县| 潜山县| 宁晋县|