中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

廈門方易網(wǎng)站制作有限公司seo站長平臺

廈門方易網(wǎng)站制作有限公司,seo站長平臺,找老外做網(wǎng)站可靠嗎,深圳手機網(wǎng)站制作價錢實現(xiàn)效果:(左邊橫屏,右邊豎屏) 前言:【使用開源項目smooth-signature 實現(xiàn)簽名的功能。Gitee 地址是 :GitHub - linjc/smooth-signature: H5帶筆鋒手寫簽名,支持PC端和移動端,任何前…

實現(xiàn)效果:(左邊橫屏,右邊豎屏)

前言:【使用開源項目smooth-signature?實現(xiàn)簽名的功能。Gitee?地址是 :GitHub - linjc/smooth-signature: H5帶筆鋒手寫簽名,支持PC端和移動端,任何前端框架均可使用

以下代碼可復(fù)制粘貼直接用,改下文件路徑即可】

1.在項目中安裝依賴包:npm install --save smooth-signature

2.我是放到一個dialog里,可根據(jù)需求自行開發(fā)。

彈框代碼:

 <!--簽名--><Dialogv-model="signatureVisible"title="電子簽名"width="100%"destroy-on-closedraggable:append-to-body="true"@close="handleClose"><div v-loading="endLoading"><ESign @closeson="closeVisi" /></div><button v-show="false" @click="closeVisi">關(guān)閉</button></Dialog>

引入模塊:

import ESign from '@/views/officeDocument/office/components/packages/ESign/src/index2.vue'

使用方法:

//電子簽名
const signatureVisible = ref(false)
const signatureBtn = () => {signatureVisible.value = true
}
//子組件關(guān)閉調(diào)用此方法
const closeVisi = () => {signatureVisible.value = false
}

2.開發(fā)電子簽名功能及樣式

電子簽名文件目錄(src/index.vue省略,主要是index2.vue文件):

packages/index.ts文件代碼:

import { App, Plugin } from 'vue'import { ESignPlugin } from './ESign'
const XiPlugin: Plugin = {install(app: App) {ESignPlugin.install?.(app)}
}export default XiPluginexport * from './ESign'

packages/Esign/index.ts文件代碼:

import { App, Plugin } from 'vue'
import ESign from './src/index.vue'export const ESignPlugin: Plugin = {install(app: App) {app.component('ESign', ESign)}
}export { ESign }

?packages/Edign/src/index2.vue文件代碼(主要代碼):

<template><div class="sign-finish"><div class="wrap1" v-show="showFull"><span class="sign-title">請在區(qū)域內(nèi)簽字</span><canvas class="canvas1" ref="canvas1"></canvas><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="handleClear2">清除</button><button class="warning" @click="handleUndo2">撤銷</button><button class="primary" @click="handleFull">豎屏</button><button class="success" @click="handlePreview2">保存</button></div></div><canvas class="canvas" ref="canvas2"></canvas></div></div>
</template><script lang="ts" setup>
import { emit } from 'process'
import { ref, watch, onMounted, onUnmounted } from 'vue'
import SmoothSignature from 'smooth-signature'//組件電子簽名
const canvas = document.querySelector('canvas')
// const signature = new SmoothSignature(canvas)
const showFull = ref(true)
const canvas2 = ref<any>(null)
const canvas1 = ref<any>(null)
const signature1 = ref<any>(null)
const signature2 = ref<any>(null)
const emit = defineEmits(['closeson'])//堅屏橫屏
const handleFull = () => {showFull.value = !showFull.value
}
const initSignature1 = () => {// const canvas = this.$refs["canvas1"]const canvas = canvas1.value as anyconst options = {width: window.innerWidth - 30,height: 200,minWidth: 2,maxWidth: 6,openSmooth: true,// color: "#1890ff",bgColor: '#f6f6f6'}signature1.value = new SmoothSignature(canvas, options)
}
const initSignture2 = () => {// const canvas = this.$refs["canvas2"]const canvas = canvas2.value as anyconst options = {width: window.innerWidth - 120,height: window.innerHeight - 80,minWidth: 3,maxWidth: 10,openSmooth: true,// color: "#1890ff",bgColor: '#f6f6f6'}signature2.value = new SmoothSignature(canvas, options)
}const handleClear1 = () => {const sgn = signature1.valuesgn.clear()
}
const handleClear2 = () => {const sgn2 = signature2.valuesgn2.clear()
}
const handleUndo1 = () => {const sgn = signature1.valuesgn.undo()
}
const handleUndo2 = () => {const sgn2 = signature2.valuesgn2.undo()
}
const handlePreview1 = () => {const sgn = signature1.valueconst isEmpty = sgn.isEmpty()if (isEmpty) {alert('isEmpty')return}// const pngUrl = sgn.getPNG()const pngUrl = sgn.getJPG()console.log(pngUrl)emit('closeson')// window.previewImage(pngUrl);
}
const handlePreview2 = () => {const sgn2 = signature2.valueconst isEmpty = sgn2.isEmpty()if (isEmpty) {alert('isEmpty')return}const canvas = sgn2.getRotateCanvas(-90)const pngUrl = canvas.toDataURL()console.log('pngUrl', pngUrl)// 生成JPG//signature.getJPG() // 或者 signature.toDataURL('image/jpeg')
}onMounted(() => {initSignature1()initSignture2()
})// onUnmounted(() => {
//   removeEventListener()
// })
</script><style scoped 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>

最后就實現(xiàn)啦!本人因項目 使用比較復(fù)雜,可根據(jù)個人情況減少代碼。參考前面的開源項目地址即可。

http://www.risenshineclean.com/news/65727.html

相關(guān)文章:

  • 服裝效果圖網(wǎng)站國際新聞快報
  • 佛山專業(yè)網(wǎng)站建設(shè)哪家好發(fā)外鏈的平臺有哪些
  • 如何做百度推廣的網(wǎng)站寫文章免費的軟件
  • 做玩網(wǎng)站怎么上傳西安網(wǎng)站seo廠家
  • 廣東省建設(shè)廳網(wǎng)站優(yōu)化師培訓(xùn)機構(gòu)
  • 網(wǎng)站建設(shè)營銷詞可以免費領(lǐng)取會員的軟件
  • 高縣住房和城鄉(xiāng)建設(shè)部網(wǎng)站百度文庫官網(wǎng)
  • 做網(wǎng)站的服務(wù)器百度網(wǎng)盤app下載安裝 官方下載
  • 保定市住房保障和城鄉(xiāng)建設(shè)局網(wǎng)站四川網(wǎng)站seo
  • 找券網(wǎng)站怎么做搜索引擎營銷的簡稱
  • 鄭州網(wǎng)絡(luò)科技有限公司網(wǎng)站首頁的優(yōu)化
  • 旅行社服務(wù)網(wǎng)點能否做網(wǎng)站百度瀏覽器app下載
  • 網(wǎng)站建設(shè)內(nèi)部問卷湖南正規(guī)seo優(yōu)化
  • 佛山專業(yè)建站公司哪家好公眾號排名優(yōu)化軟件
  • 如何編輯 wordpress 主題seo短視頻保密路線
  • 建立一個簡單的企業(yè)官網(wǎng)seo現(xiàn)在還有前景嗎
  • 網(wǎng)站設(shè)計行業(yè)背景搜狗搜索引擎優(yōu)化指南
  • 新浪網(wǎng)站怎么做推廣域名注冊平臺哪個好
  • 哪個網(wǎng)站使用vue 做的全網(wǎng)營銷網(wǎng)絡(luò)推廣
  • 網(wǎng)站建設(shè)推廣特色新人學(xué)會seo
  • 在線作圖軟件寧波seo外包代運營
  • 廣州網(wǎng)站備案企業(yè)網(wǎng)站seo推廣方案
  • 企業(yè)品牌網(wǎng)站建設(shè)費用小姐關(guān)鍵詞代發(fā)排名
  • 深圳做網(wǎng)站推廣的公司哪家好長沙網(wǎng)站seo推廣公司
  • 動態(tài)手機網(wǎng)站怎么做seo是什么的簡稱
  • 做網(wǎng)頁專題 應(yīng)該關(guān)注哪些網(wǎng)站360收錄提交入口網(wǎng)址
  • 優(yōu)秀設(shè)計師網(wǎng)站公司企業(yè)網(wǎng)站建設(shè)
  • 上海做網(wǎng)站哪家好山東濟南最新事件
  • 網(wǎng)站文章優(yōu)化事項百度競價開戶流程
  • 張家口遠(yuǎn)大建設(shè)集團網(wǎng)站怎么創(chuàng)建網(wǎng)站的快捷方式