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

Element UI +Vue頁面生成二維碼的方法

這篇具有很好參考價(jià)值的文章主要介紹了Element UI +Vue頁面生成二維碼的方法。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

一、方法一 采用qrcodejs2生成

1.1、安裝二維碼插件qrcodejs2

//在終端輸入npm命令,安裝二維碼插件

npm install qrcodejs2 --save

1.2、在vue文件中,引入生成二維碼插件

import QRCode from 'qrcodejs2';        //在vue文件中,引入生成二維碼插件

1.3、構(gòu)建二維碼對(duì)象qrCodeDiv

全部代碼

<!-- 生成綁定微信二維碼界面 -->
    <el-dialog
      title="微信掃碼綁定用戶"
      :visible.sync="isShowCard"
      width="400px"
      center
      :before-close="jieBangClose"
    >
      <!-- 定義一個(gè)展示二維碼的div -->
      <div style="display: flex; justify-content: center">
        <!-- 二維碼對(duì)象可以通過 ref 綁定 -->
        <div id="qrCode" ref="qrCodeDiv"></div>
      </div>
    </el-dialog>
 
// 1. 方法調(diào)用 
bangding(row){
      let memberId = row.memberId;
      this.isShowCard = true;
      if(this.ids != null){
        memberId = this.ids[0];
      }
      this.createQRCode(memberId);
}
//2. 具體的綁定方法
createQRCode(id){
      this.$nextTick(()=>{
      this.$refs.qrCodeDiv.innerHTML = '';//二維碼清除
      alert(id)
      new QRCode(this.$refs.qrCodeDiv, {
          text: "id="+ id,//二維碼鏈接,參數(shù)是否添加看需求
          width: 200,//二維碼寬度
          height: 200,//二維碼高度
          colorDark: "#333333", //二維碼顏色
          colorLight: "#ffffff", //二維碼背景色
          correctLevel: QRCode.CorrectLevel.L //容錯(cuò)率,L/M/H
        });
      })
    }

一、方法二 -采用qrcode生成

2.1、安裝qrcode

yarn add qrcode

2.2、頁面引入

import QRCode from 'qrcode';

2.3、方法里邊使用

getQRCodeUrl(){  
 QRCode.toDataURL(
 'hello world',{
 color: {
 dark:"#010599FF",
 light:"#FFBF60FF"
           }
         }
      )
       .then((url) => {
 // 獲取到url后即可在頁面使用--二維碼圖片
 console.log('url', url)
       })
       .catch((e) => {
 console.log('e', e)
       });
 }

2.4、options

名稱 類型 默認(rèn)值 說明
errorCorrectionLevel String M 錯(cuò)誤處理級(jí)別??蛇x值:low, medium, quartile, high or L, M, Q, H
maskPattern Number 可選值:0, 1, 2, 3, 4, 5, 6, 7
margin Number 4
scale Number 4
width Number
color.dark String #000000ff
color.light String #ffffffff

三、方法三 vue-qr

3.1、安裝

yarn add vue-qr

3.2、頁面引入

import VueQr from 'vue-qr'

3.3、組件增加vue-qr

components: { 
	VueQr 
},

3.4、template使用

logoSrc中間logo文章來源地址http://www.zghlxwxcb.cn/news/detail-840126.html

<vue-qr style="width:200px;height:200px;" logoSrc="https://image.dandelioncloud.cn//dist/img/NoSlightly.png" text="Hello world!" :size="200"></vue-qr>

3.5、options

Parameter Explanation
text Contents to encode. 欲編碼的內(nèi)容
correctLevel Correct Level 0-3 容錯(cuò)級(jí)別 0-3
size Width as well as the height of the output QR code, includes margin. 尺寸, 長寬一致, 包含外邊距
margin Margin to add around the QR code, default 20px. 二維碼圖像的外邊距, 默認(rèn) 20px
colorDark Color of “true” blocks. Works only when both colorDark and colorLight are set. (BYTE_DTA, BYTE_POS, BYTE_AGN, BYTE_TMG) 實(shí)點(diǎn)的顏色
colorLight Color of empty space, or “false” blocks. Works only when both colorDark and colorLight are set. (BYTE_EPT) 空白區(qū)的顏色
components Controls the appearances of parts in the QR code. Read section ComponentOptions to learn more. 閱讀 ComponentOptions 了解更多信息
bgSrc Background url to embed in the QR code. 欲嵌入的背景圖地址
gifBgSrc Gif background url to embed in the QR code, If gifBackground is set, backgroundImage will be ignored. This option will affects performance. 欲嵌入的背景圖 gif 地址,設(shè)置后普通的背景圖將失效。設(shè)置此選項(xiàng)會(huì)影響性能
backgroundColor Background color 背景色
backgroundDimming Color mask to add above the background image. Helpful when having problems with decoding. 疊加在背景圖上的顏色, 在解碼有難度的時(shí)有一定幫助
logoSrc Logo url to embed at the center of generated QR code 嵌入至二維碼中心的 LOGO 地址
logoScale Value used to scale the logo image. Larger value may result in decode failure. Size of the logo equals to logoScale*(size-2margin). Default is 0.2. 用于計(jì)算 LOGO 大小的值, 過大將導(dǎo)致解碼失敗, LOGO 尺寸計(jì)算公式 logoScale(size-2*margin), 默認(rèn) 0.2
logoMargin White margin that appears around the logo image. Default is 0. LOGO 標(biāo)識(shí)周圍的空白邊框, 默認(rèn)為0
logoBackgroundColor Logo background color, need set logo margin. Logo 背景色,需要設(shè)置 logo margin
logoCornerRadius Radius of the logo’s corners.Default is 0 LOGO 標(biāo)識(shí)及其邊框的圓角半徑, 默認(rèn)為0
whiteMargin If set to true, a white border will appear around the background image. Default is true. 若設(shè)為 true, 背景圖外將繪制白色邊框
dotScale Value used to scale down the data dots’ size. (0 < scale < 1.0) default 1 數(shù)據(jù)區(qū)域點(diǎn)縮小比例,默認(rèn)為1
autoColor If set to true, the dominant color of backgroundImage will be used as colorDark. Default is true. 若為 true, 背景圖的主要顏色將作為實(shí)點(diǎn)的顏色, 即 colorDark,默認(rèn) true
binarize If set to true, the whole image will be binarized with the given threshold, or default threshold if not specified. Default is false. 若為 true, 圖像將被二值化處理, 未指定閾值則使用默認(rèn)值
binarizeThreshold Threshold used to binarize the whole image. Default is 128. (0 < threshold < 255) 二值化處理的閾值
callback Data URI of the generated QR code will be available here. 生成的二維碼 Data URI 可以在回調(diào)中取得,第一個(gè)參數(shù)為二維碼 data URL, 第二個(gè)參數(shù)為 props 傳過來的 qid(因?yàn)槎S碼生成是異步的,所以加個(gè) id 用于排序)
bindElement If set to true, the generated QR will bind to a HTML element automatically. Default is true. 指定是否需要自動(dòng)將生成的二維碼綁定到HTML上, 默認(rèn)是true

到了這里,關(guān)于Element UI +Vue頁面生成二維碼的方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

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

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

相關(guān)文章

  • 小程序?qū)⒈卷撁嫔啥S碼,二維碼掃碼帶參數(shù)進(jìn)小程序指定頁面

    小程序?qū)⒈卷撁嫔啥S碼,二維碼掃碼帶參數(shù)進(jìn)小程序指定頁面

    1、因?yàn)樾〕绦蛘{(diào)用 https://api.weixin.qq.com/ 不能直接調(diào)用這個(gè)接口,所以我們需要在ApiPost上先測試一下生成一下二維碼,生成測試沒問題后可以讓后端調(diào)用返回給前端。 獲取access_token方法官方文檔地址如下: https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html

    2024年02月15日
    瀏覽(26)
  • vue批量生成二維碼,打印生成的二維碼,并批量下載生成的二維碼,qrcode

    vue批量生成二維碼,打印生成的二維碼,并批量下載生成的二維碼,qrcode

    通過使用 qrcode 生成二維碼, 使用 jszip 打包批量二維碼文件, 使用 file-saver 下載打包好的zip文件, 使用 vue-print-nb 打印生成的二維碼 配置項(xiàng): width 二維碼寬度 height 二維碼高度 errorCorrectionLevel 二維碼糾錯(cuò)級(jí)別,指二維碼被遮擋可以掃出結(jié)果的區(qū)域比例 color: 7. 打印生成的二

    2024年02月01日
    瀏覽(31)
  • 微信小程序任意指定頁面生成二維碼

    微信小程序任意指定頁面生成二維碼

    在日常微信小程序運(yùn)營中,文章,和朋友圈海報(bào)內(nèi)總會(huì)用到微信小程序特定頁面二維碼 ps:一定要輸入當(dāng)前小程序小程序項(xiàng)目成員的微信號(hào)

    2024年02月11日
    瀏覽(26)
  • vue生成二維碼

    本次將教大家如何只通過vue前端快速的生成二維碼 安裝依賴 通過命令 安裝二維碼生成的依賴包到我們的項(xiàng)目中 引入 在自己需要構(gòu)建生成的頁面進(jìn)行引入 構(gòu)建通用方法 ps: 其中里面的參數(shù) classId 為html的class標(biāo)簽名稱 value 為需要將哪些數(shù)據(jù)進(jìn)行構(gòu)建生成二維碼 通過該方法,我

    2024年02月12日
    瀏覽(20)
  • 微信小程序生成頁面分享二維碼(代碼親測有效)

    說明: 獲取不限制的小程序碼 | 微信開放文檔 以上是官網(wǎng)鏈接,可以自行查看 不懂的可以留言告訴我

    2024年02月11日
    瀏覽(20)
  • vue:生成二維碼 qrcode、vue-qr(二維碼中間可帶logo)

    vue:生成二維碼 qrcode、vue-qr(二維碼中間可帶logo)

    一、方法一 qrcode qrcode - npm 1.1、安裝 yarn add qrcode 1.2、頁面引入 1.3、方法里邊使用 ?二維碼url: ???????? 1.4、options 名稱 類型 默認(rèn)值 說明 errorCorrectionLevel String M 錯(cuò)誤處理級(jí)別??蛇x值: low ,? medium ,? quartile ,? high ?or? L ,? M ,? Q ,? H maskPattern Number 可選值: 0 ,?

    2023年04月12日
    瀏覽(29)
  • vue,uniapp生成二維碼

    話不多說直接開干 先是vue的 1,首先按照一下依賴 2,在需要使用的頁面引入 3,使用 然后是uniapp // 1,新建一個(gè)js文件夾,把以下代碼放進(jìn)來,代碼我放在最后了,js文件名為uqrcode.js 2,在使用的頁面引用 3,在使用前需要有一個(gè)畫布 4,使用 下面附上js代碼

    2024年02月11日
    瀏覽(15)
  • 使用uniapp生成二維碼并下載,小程序掃碼進(jìn)入指定頁面

    使用uniapp生成二維碼并下載,小程序掃碼進(jìn)入指定頁面

    功能1:通過掃碼鏈接進(jìn)入小程序指定頁面(帶參數(shù)) 功能2:將網(wǎng)址鏈接(帶參數(shù))在微信小程序中使用二維碼展示出來,并可以點(diǎn)擊下載二維碼圖片 ?掃碼鏈接進(jìn)入指定頁面并且?guī)?shù) 在小程序管理后臺(tái)-開發(fā)管理-開發(fā)設(shè)置-掃普通鏈接二維碼打開小程序中,配置鏈接地址,

    2024年02月11日
    瀏覽(26)
  • (微信機(jī)器人)小程序轉(zhuǎn)二維碼,給微信機(jī)器人發(fā)送小程序生成二維碼,打開H5頁面跳轉(zhuǎn)到小程序

    最早知道這個(gè)需求的時(shí)候是一個(gè)朋友說的,然后研究了一番,后來發(fā)現(xiàn)也沒那么難,符合相關(guān)的規(guī)范就可以了。 本來就有獲取微信appid和pagepath的功能了,感覺轉(zhuǎn)成二維碼應(yīng)該不難。 主要是符合這個(gè)要求,目錄 | 微信開放文檔 1、在需要調(diào)用 JS 接口的頁面引入如下 JS 文件:

    2024年02月14日
    瀏覽(26)
  • vue 生成二維碼的兩種方式

    方式一:qrcode(無 icon 圖標(biāo)) 完整代碼 方式二:vue-qr(有 icon 圖標(biāo)) 官網(wǎng)地址:vue-qr - npm import 引入方式 完整代碼 相關(guān)配置屬性 屬性名 含義 text 編碼內(nèi)容 correctLevel 容錯(cuò)級(jí)別(0 - 3) size 尺寸,長寬一致, 包含外邊距 margin 二維碼圖像的外邊距,默認(rèn) 20px colorDark 實(shí)點(diǎn)的顏色

    2024年02月15日
    瀏覽(20)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包