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

vue使用smooth-signature實(shí)現(xiàn)移動(dòng)端橫豎屏電子簽字

 更新時(shí)間:2023年10月27日 10:08:24   作者:菜鳥(niǎo)書(shū)生  
這篇文章主要為大家介紹了vue使用smooth-signature實(shí)現(xiàn)移動(dòng)端橫豎屏電子簽字示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

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

使用smooth-signature

npm install --save smooth-signature

頁(yè)面引入插件

import SmoothSignature from "smooth-signature";

實(shí)現(xiàn)效果

完整代碼

<template>
  <div class="sign-finish">
    <div class="wrap1" v-show="showFull">
      <span class="sign-title">請(qǐng)?jiān)趨^(qū)域內(nèi)簽字</span>
      <canvas class="canvas1" ref="canvas1" />
      <div class="actions">
          <button class="danger" @click="handleClear1" >清除</button>
          <button class="warning" @click="handleUndo1" >撤銷(xiāo)</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" >撤銷(xiāo)</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

以上就是vue使用smooth-signature實(shí)現(xiàn)移動(dòng)端橫豎屏電子簽字的詳細(xì)內(nèi)容,更多關(guān)于vue smooth-signature電子簽字的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Vue修飾符的使用詳解

    Vue修飾符的使用詳解

    為了方便大家寫(xiě)代碼,Vue給大家提供了很多方便的修飾符,比如我們經(jīng)常用到的取消冒泡,阻止默認(rèn)事件等等,這篇文章將給大家分享Vue?中的常用的修飾符
    2022-10-10
  • Vue表單實(shí)例代碼

    Vue表單實(shí)例代碼

    Vue.js 是用于構(gòu)建交互式的 Web 界面的庫(kù)。這篇文章主要介紹了Vue表單實(shí)例代碼的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-09-09
  • Vue Router參數(shù)傳遞的多種方式小結(jié)

    Vue Router參數(shù)傳遞的多種方式小結(jié)

    在 Vue.js 開(kāi)發(fā)中,vue-router 是構(gòu)建單頁(yè)面應(yīng)用(SPA)的核心工具之一,它不僅能幫助我們管理路由,還能在不同頁(yè)面之間傳遞參數(shù),本文將詳細(xì)介紹 vue-router 中常見(jiàn)的參數(shù)傳遞方式,并通過(guò)實(shí)際示例幫助你快速掌握這些技巧,需要的朋友可以參考下
    2025-04-04
  • 示例解析Ant?Design?Vue組件slots作用

    示例解析Ant?Design?Vue組件slots作用

    這篇文章主要為大家通過(guò)示例解析Ant?Design?Vue組件slots作用,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-05-05
  • 三步搞定:Vue.js調(diào)用Android原生操作

    三步搞定:Vue.js調(diào)用Android原生操作

    這篇文章主要介紹了三步搞定:Vue.js調(diào)用Android原生操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-09-09
  • 詳解Vue中l(wèi)ocalstorage和sessionstorage的使用

    詳解Vue中l(wèi)ocalstorage和sessionstorage的使用

    這篇文章主要介紹了詳解Vue中l(wèi)ocalstorage和sessionstorage的使用方法和經(jīng)驗(yàn)心得,有需要的朋友跟著小編參考學(xué)習(xí)下吧。
    2017-12-12
  • vant實(shí)現(xiàn)購(gòu)物車(chē)功能

    vant實(shí)現(xiàn)購(gòu)物車(chē)功能

    這篇文章主要為大家詳細(xì)介紹了vant實(shí)現(xiàn)購(gòu)物車(chē)功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-06-06
  • vue3+three.js的理解與簡(jiǎn)單使用示例代碼

    vue3+three.js的理解與簡(jiǎn)單使用示例代碼

    Three.js是一個(gè)基于WebGL的開(kāi)源JavaScript?3D引擎,它簡(jiǎn)化了Web?3D開(kāi)發(fā)流程,讓開(kāi)發(fā)者能夠輕松創(chuàng)建3D場(chǎng)景、動(dòng)畫(huà)和交互體驗(yàn),這篇文章主要介紹了vue3+three.js理解與簡(jiǎn)單使用的相關(guān)資料,需要的朋友可以參考下
    2026-02-02
  • Vue3中頁(yè)面重定向的方式匯總

    Vue3中頁(yè)面重定向的方式匯總

    Vue3?中頁(yè)面重定向主要依賴?Vue?Router?4,這是一個(gè)Vue3?配套的路由庫(kù),具體分為路由配置式重定向、編程式導(dǎo)航重定向和路由守衛(wèi)重定向三類(lèi)場(chǎng)景,以下是各種方式匯總,需要的朋友可以參考下
    2025-12-12
  • vue3響應(yīng)式轉(zhuǎn)換常用API操作示例代碼

    vue3響應(yīng)式轉(zhuǎn)換常用API操作示例代碼

    在Vue 3中,響應(yīng)式系統(tǒng)得到了顯著改善,包括使用Composition API時(shí)更加靈活的狀態(tài)管理,這篇文章主要介紹了vue3響應(yīng)式轉(zhuǎn)換常用API操作示例代碼,需要的朋友可以參考下
    2024-08-08

最新評(píng)論

泰安市| 江山市| 海口市| 博爱县| 瑞金市| 夏河县| 盖州市| 乐山市| 平谷区| 金山区| 肃宁县| 五大连池市| 准格尔旗| 潜山县| 宜昌市| 永定县| 新宁县| 湾仔区| 微博| 临安市| 抚顺市| 桑日县| 册亨县| 万安县| 玉门市| 白朗县| 呈贡县| 剑阁县| 云阳县| 冷水江市| 牙克石市| 尖扎县| 武功县| 大足县| 正蓝旗| 旺苍县| 廊坊市| 濮阳市| 海南省| 深水埗区| 霞浦县|