国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

vue使用smooth-signature實現(xiàn)移動端電子簽字,包括橫豎屏

這篇具有很好參考價值的文章主要介紹了vue使用smooth-signature實現(xiàn)移動端電子簽字,包括橫豎屏。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

vue使用smooth-signature實現(xiàn)移動端電子簽字,包括橫豎屏

1.使用smooth-signature

npm install --save smooth-signature

二.頁面引入插件

import SmoothSignature from "smooth-signature";

三.實現(xiàn)效果

vue使用smooth-signature實現(xiàn)移動端電子簽字,包括橫豎屏,js,電子簽字,vue,vue.js,前端,javascript

vue使用smooth-signature實現(xiàn)移動端電子簽字,包括橫豎屏,js,電子簽字,vue,vue.js,前端,javascript

四.完整代碼

<template>
  <div class="sign-finish">
    <div class="wrap1" v-show="showFull">
      <span class="sign-title">請在區(qū)域內(nèi)簽字</span>
      <canvas class="canvas1" ref="canvas1" />
      <div class="actions">
          <button class="danger" @click="handleClear1" >清除</button>
          <button class="warning" @click="handleUndo1" >撤銷</button>
          <button class="primary" @click="handleFull" >橫屏</button>
          <button class="success" @click="handlePreview1" >保存</button>
      </div>
    </div>
    <div class="wrap2" v-show="!showFull">
      <div class="actionsWrap">
        <div class="actions">
          <button class="danger" @click="handleClear1" >清除</button>
          <button class="warning" @click="handleUndo1" >撤銷</button>
          <button class="primary" @click="handleFull" >豎屏</button>
          <button class="success" @click="handlePreview1" >保存</button>
        </div>
      </div>
      <canvas class="canvas" ref="canvas2" />
    </div>
  </div>
</template>

<script>
import SmoothSignature from "smooth-signature";
export default {
  name: "mbDemo",
  data() {
    return {
      showFull: true,
    };
  },
  mounted() {
    this.initSignature1();
    this.initSignture2();
  },
  methods: {
    initSignature1() {
      const canvas = this.$refs["canvas1"];
      const options = {
        width: window.innerWidth - 30,
        height: 200,
        minWidth: 2,
        maxWidth: 6,
        openSmooth:true,
        // color: "#1890ff",
        bgColor: '#f6f6f6',
      };
      this.signature1 = new SmoothSignature(canvas, options);
    },
    initSignture2() {
      const canvas = this.$refs["canvas2"];
      const options = {
        width: window.innerWidth - 120,
        height: window.innerHeight - 80,
        minWidth: 3,
        maxWidth: 10,
        openSmooth:true,
        // color: "#1890ff",
        bgColor: '#f6f6f6',
      };
      this.signature2 = new SmoothSignature(canvas, options);
    },
    handleClear1() {
      this.signature1.clear();
    },
    handleClear2() {
      this.signature2.clear();
    },
    handleUndo1() {
      this.signature1.undo();
    },
    handleUndo2() {
      this.signature2.undo();
    },
    handleFull() {
      this.showFull = !this.showFull;
    },
    handlePreview1() {
      const isEmpty = this.signature1.isEmpty();
      if (isEmpty) {
        alert("isEmpty");
        return;
      }
      const pngUrl = this.signature1.getPNG();
      console.log(pngUrl);
      // window.previewImage(pngUrl);
    },
    handlePreview2() {
      const isEmpty = this.signature2.isEmpty();
      if (isEmpty) {
        alert("isEmpty");
        return;
      }
      const canvas = this.signature2.getRotateCanvas(-90);
      const pngUrl = canvas.toDataURL();
      console.log('pngUrl',pngUrl);
      // window.previewImage(pngUrl, 90);
    },
  },
};
</script>

<style lang="less">
.sign-finish {
  height: 100vh;
  width: 100vw;
  button {
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 2px;
  }
  .danger {
    color: #fff;
    background: #ee0a24;
    border: 1px solid #ee0a24;
  }
  .warning {
    color: #fff;
    background: #ff976a;
    border: 1px solid #ff976a;
  }
  .primary {
    color: #fff;
    background: #1989fa;
    border: 1px solid #1989fa;
  }
  .success {
    color: #fff;
    background: #07c160;
    border: 1px solid #07c160;
  }
  canvas {
    border-radius: 10px;
    border: 2px dashed #ccc;
    
  }
  .wrap1 {
    height: 100%;
    width: 96%;
    margin: auto;
    margin-top: 100px;
    .actions {
      display: flex;
      justify-content: space-around;
    }
  }
  .wrap2 {
    padding: 15px;
    height: 100%;
    display: flex;
    justify-content: center;
    .actionsWrap {
      width: 50px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .canvas {
      flex: 1;
    }
    .actions {
      margin-right: 10px;
      white-space: nowrap;
      transform: rotate(90deg);
      button{
          margin-right: 20px;
      }
    }
  }
}
</style>

五.參考

https://github.com/linjc/smooth-signature文章來源地址http://www.zghlxwxcb.cn/news/detail-724834.html

到了這里,關(guān)于vue使用smooth-signature實現(xiàn)移動端電子簽字,包括橫豎屏的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 使用JavaScript和Vue.js框架開發(fā)的電子商務(wù)網(wǎng)站,實現(xiàn)商品展示和購物車功能

    引言: 隨著互聯(lián)網(wǎng)的快速發(fā)展和智能手機的普及,電子商務(wù)行業(yè)正迎來一個全新的時代。越來越多的消費者選擇網(wǎng)上購物,而不再局限于傳統(tǒng)的實體店。這種趨勢不僅僅是改變了消費者的習(xí)慣購物,也給企業(yè)帶來了巨大的商機。為了不斷滿足消費者的需求,電子商務(wù)網(wǎng)站需要

    2024年02月15日
    瀏覽(27)
  • VUE使用Three.js實現(xiàn)模型,點擊交互,相機旋轉(zhuǎn)視角跟隨移動(Threejs中使用Tweenjs,含demo源碼)

    VUE使用Three.js實現(xiàn)模型,點擊交互,相機旋轉(zhuǎn)視角跟隨移動(Threejs中使用Tweenjs,含demo源碼)

    目錄 一、Three.js是什么? 二、VUE簡單使用Three.js步驟 1.npm安裝 2.template模板 3.引入庫 4.定義全局變量 5.初始化場景 6.初始化相機 7.初始化燈光 8.初始化渲染器 9.創(chuàng)建模型(這里我搭建的模型是一個簡單雙面貨架模型) 10.根據(jù)瀏覽器窗口自適應(yīng) 11.初始化函數(shù),頁面加載完成時調(diào)用

    2024年02月03日
    瀏覽(104)
  • 標(biāo)簽平滑(label smoothing) torch和tensorflow的實現(xiàn)

    標(biāo)簽平滑(label smoothing) torch和tensorflow的實現(xiàn)

    在常見的多分類問題中,先經(jīng)過softmax處理后進行交叉熵計算,原理很簡單可以將計算loss理解為,為了使得網(wǎng)絡(luò)對測試集預(yù)測的概率分布和其真實分布接近,常用的做法是使用one-hot對真實標(biāo)簽進行編碼,然后用預(yù)測概率去擬合one-hot的真實概率。但是這樣會帶來兩個問題: 無

    2024年02月01日
    瀏覽(15)
  • 前端VUE實現(xiàn)電子簽名

    1,引入第三方庫來實現(xiàn) 2,代碼實現(xiàn) 在頁面引入 首先在template中添加了一個div,用來顯示簽名區(qū)域。然后通過fabric庫實例化了一個canvas,設(shè)置isDrawingMode為true,表示可以進行繪圖操作。 methods中,實現(xiàn)了保存簽名的方法,通過canvas.toDataURL()方法將簽名數(shù)據(jù)轉(zhuǎn)化為base64編碼的p

    2024年02月15日
    瀏覽(13)
  • vue2 之 實現(xiàn)pdf電子簽章

    vue2 之 實現(xiàn)pdf電子簽章

    仿照e簽寶,實現(xiàn)pdf電子簽章 = 拿到pdf鏈接,移動章的位置,獲取章的坐標(biāo) 技術(shù) : 使用fabric + pdfjs-dist + vuedraggable 一位大佬的代碼倉虧 : 地址 一位大佬寫的文章 :地址 在大佬的代碼基礎(chǔ)上,進行了些許優(yōu)化,變的更像e簽寶 ps : 怕版本不同,導(dǎo)致無法運行,請下載指定版本

    2024年02月03日
    瀏覽(18)
  • vue - vue簡單實現(xiàn)移動端的table表格

    vue - vue簡單實現(xiàn)移動端的table表格

    vue實現(xiàn)移動端的table表格,效果圖如下: 主要實現(xiàn)功能: 1,表頭字段可以進行正序倒序排序功能; 2,可以展開收起; 3,藍色這一行是合計數(shù)據(jù) 需要單獨出來進行渲染,否則排序的時候此行會排亂掉; 用到的模擬數(shù)據(jù)會放到最后面; 4,注意表頭數(shù)據(jù)thList,title是標(biāo)題,

    2024年02月16日
    瀏覽(24)
  • 純vue 獲取usb串口,實現(xiàn)電子秤的對接

    純vue 獲取usb串口,實現(xiàn)電子秤的對接

    說明:解決生產(chǎn)上過秤重量手動輸入出錯問題 效果圖: ?一:代碼部分 ? ? ? ? 1、創(chuàng)建一個名字為seriaport.js文件(隨便定義,為下面頁面引入使用) ???????? ? ? ? ? 2、創(chuàng)建一個為usb.json 文件(隨便定義,為下面頁面引入使用) ? ? ? ? 文件過大,下載地址(因為大

    2024年02月07日
    瀏覽(80)
  • 記錄-Vue移動端日歷設(shè)計與實現(xiàn)

    記錄-Vue移動端日歷設(shè)計與實現(xiàn)

    選擇月份和選擇年份與日期做了條件渲染,切換方式是點擊頂部時間切換選項 日數(shù)據(jù)的顯示一共42條數(shù)據(jù),先獲取當(dāng)前月的總天數(shù),將每個月的天數(shù)保存在一個數(shù)組里,然后根據(jù)傳入的參數(shù)返回相應(yīng)的天數(shù), 因為有閏年的存在,2月會是29天,所以做了閏年的判斷.然后獲取每周的第一天

    2023年04月26日
    瀏覽(20)
  • vue3移動端實現(xiàn)pdf預(yù)覽

    vue3移動端實現(xiàn)pdf預(yù)覽

    使用的插件有: html部分: js部分: 我一開始使用的時第一種方法,然后測試之后發(fā)現(xiàn) 蘋果手機會顯示pdf加載出錯了 ,安卓手機可以正常顯示,于是換成了第二種方法。 html部分: js部分: 用了第二種插件后,蘋果手機還是加載不出來,后面查到因為pdfjs-dist有時候會出現(xiàn)部

    2024年02月02日
    瀏覽(32)
  • vue實現(xiàn)鼠標(biāo)拖拽div左右移動的功能

    vue實現(xiàn)鼠標(biāo)拖拽div左右移動的功能

    直接代碼: 這部分區(qū)域可以鼠標(biāo)拖拽左右滾動

    2024年02月03日
    瀏覽(95)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包