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

Qrcode前端生成二維碼,列表循環(huán),可以下載分享,附加功能

這篇具有很好參考價(jià)值的文章主要介紹了Qrcode前端生成二維碼,列表循環(huán),可以下載分享,附加功能。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

?Qrcode前端生成二維碼,列表循環(huán),可以下載分享,附加功能

前言:?

? ? ? ? 項(xiàng)目需求,原型列表要求展示二維碼,然后后端那邊因?yàn)槟撤N原因沒(méi)有給我返回這個(gè)參數(shù),無(wú)奈只好前端自己來(lái)做,于是乎便有了下面的操作,這篇文章來(lái)整理下。

????????主要功能:

? ? ? ? ? ? ? ? 1.生成二維碼

? ? ? ? ? ? ? ? 2.渲染列表

? ? ? ? ? ? ? ? 3.生成圖片下載

? ? ? ? ? ? ? ? 4.分享二維碼

下面開(kāi)始吧

?原型圖

new qrcode,javascript,前端,javascript,vue.js

?demo效果圖:

??

先來(lái)幾張效果圖

new qrcode,javascript,前端,javascript,vue.js

?再來(lái)個(gè)掃碼識(shí)別出來(lái)的

new qrcode,javascript,前端,javascript,vue.js

?生成二維碼

?安裝命令

npm install qrcodejs2 --save

頁(yè)面引入

import QRCode from "qrcodejs2";

?實(shí)現(xiàn)1寫法

       bindQRCode: function() {
         new QRCode(this.$refs.qrCodeDiv, {
           text: 'Vue實(shí)現(xiàn)生成二維碼!',
           width: 200,
           height: 200,
           colorDark: "#333333", //二維碼顏色
           colorLight: "#ffffff", //二維碼背景色
           correctLevel: QRCode.CorrectLevel.L //容錯(cuò)率,L/M/H
         })
       }

實(shí)現(xiàn)2寫法?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-775729.html

     
html
    <div id="qrcode"></div>


js

creatQrCode(qrUrl) {
        new QRCode(document.getElementById("qrcode"), {
          text: qrUrl,
          width: 128,
          height: 128,
          colorDark: "#000000",
          colorLight: "#ffffff",
          correctLevel: QRCode.CorrectLevel.H
        });
      },

下載二維碼

savePic() {
      let qrCodeCanvas = document.getElementById("qrcode").getElementsByTagName("canvas");
      let a = document.createElement("a");
      a.href = qrCodeCanvas[0].toDataURL("image/url");
      a.download = `【${this.$microWidgetProps.contextMenu.getSelections[0].name}】二維碼.png`;
      a.click();
}

?渲染列表

<template>
  <div>
    <div id="qqq">
      <div class="qrcode" ref="qrCodeUrl"></div>
    </div>
    <div id="qrcode">
    </div>
    <el-button type="primary">主要按鈕</el-button>
    <el-table :data="list" height="250" border style="width: 100%">
      <el-table-column prop="product_code" label="日期" width="180">
      </el-table-column>
      <el-table-column prop="product_name" label="姓名" width="180">
      </el-table-column>
      <el-table-column prop="tech_index" label="地址">
      </el-table-column>
      <el-table-column prop="qrCode" label="二維碼">
        <template slot-scope="scope">
          <!-- <img :src="scope.row.qrCode" alt=""> -->
          <el-image :src="scope.row.qrCode" :preview-src-list="[...scope.row.qrCode]"></el-image>
        </template>
      </el-table-column>
    </el-table>
  </div>

</template>
<script>
  import QRCode from 'qrcodejs2'
  export default {
    data() {
      return {
        list: [{
            product_code: "123",
            product_name: '小黑子',
            tech_index: '技術(shù)指標(biāo)',
            exec_std: '執(zhí)行標(biāo)準(zhǔn)',
            // qrCode:""
          },
          {
            product_code: "123",
            product_name: '小黑子',
            tech_index: '技術(shù)指標(biāo)',
            exec_std: '執(zhí)行標(biāo)準(zhǔn)',
            // qrCode:''
          },
          {
            "address": "1",
            "attention_item": "1雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪",
            "company_id": 22,
            "created_time": "2023-03-23 21:31:11",
            "created_user_id": 2157,
            "created_user_name": "111222",
            "enterprise": "1",
            "exec_std": "1雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪",
            "feature": "1雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪",
            "goods_code": "123",
            "hns_require": "1雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪",
            "id": 3,
            "is_del": "0",
            "net_content": "1",
            "product_code": "123",
            "product_name": "1",
            "tech_index": "1雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪",
            "telephone": "1",
            "updated_time": "2023-03-24 13:37:31",
            "updated_user_id": 2157,
            "updated_user_name": "111222",
            "use_method": "1雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪鐵龍雪",
            "qrCode": ""
          },
          {
            "address": "湖北武漢",
            "attention_item": "無(wú)",
            "company_id": 22,
            "created_time": "2023-03-22 17:43:02",
            "created_user_id": 2157,
            "created_user_name": "111222",
            "enterprise": "湖北雪佛蘭",
            "exec_std": "無(wú)",
            "feature": "無(wú)",
            "goods_code": "001",
            "hns_require": "無(wú)",
            "id": 1,
            "is_del": "0",
            "net_content": "1.5",
            "product_code": "001",
            "product_name": "雪弗蘭C6",
            "tech_index": "無(wú)",
            "telephone": "17899998888",
            "updated_time": "2023-03-22 17:43:01",
            "use_method": "無(wú)",
            "qrCode": ""
          }
        ]
      }
    },
    mounted() {
      this.getDatalist()
    },
    methods: {
      getDatalist() {
        this.list.forEach(item => {
          const qrCodeData = JSON.stringify(item);
          console.log(qrCodeData, 'qrCodeData')
           const qrCodeUrl = `https://www.baidu.com/h5?data=${qrCodeData}`;
          const qrCodeImage = new QRCode(document.getElementById("qrcode"), {
            text: qrCodeUrl,
            width: 128,
            height: 128,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.L
          });
          console.log(qrCodeImage, '=====qrCodeImage')
          item.qrCode = qrCodeImage._oDrawing._elCanvas.toDataURL("image/png");
          console.log(' item.qrCode', item.qrCode)
        });


      },
    }
  }
</script>

<style>
  #qqq {
    background-color: #111;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    /*水平居中*/
    position: relative;
  }

  .qrcode {
    display: inline-block;
    margin: 0 auto;
    /*水平居中*/
    position: relative;
    top: 15%;
  }

  .qrcode img {
    width: 200px;
    height: 200px;
    background-color: #fff;
    padding: 6px;
  }
</style>

?分享二維碼

<template>
  <div>
    <div id="qqq">
      <div class="qrcode" ref="qrCodeUrl"></div>
    </div>
    <div id="qrcode">
    </div>
    <el-button type="primary">主要按鈕</el-button>
    <el-table :data="list" height="250" border style="width: 100%">
      <el-table-column prop="product_code" label="日期" width="180">
      </el-table-column>
      <el-table-column prop="product_name" label="姓名" width="180">
      </el-table-column>
      <el-table-column prop="tech_index" label="地址">
      </el-table-column>
      <el-table-column prop="qrCode" label="二維碼">
        <template slot-scope="scope">
          <el-image :src="scope.row.qrCode" :preview-src-list="[...scope.row.qrCode]"></el-image>
        </template>
      </el-table-column>
    </el-table>
<div class="fl">分享到:</div>
<div onclick="shareTo('qzone')">
    <img src="http://zixuephp.net/static/images/qqzoneshare.png" width="30">
</div>
<div onclick="shareTo('qq')">
    <img src="http://zixuephp.net/static/images/qqshare.png" width="32">
</div>
<div onclick="shareTo('sina')">
    <img src="http://zixuephp.net/static/images/sinaweiboshare.png" width="36">
</div>
<div onclick="shareTo('wechat')">
    <img src="http://zixuephp.net/static/images/wechatshare.png" width="32">
</div>
  </div>


</template>
<script>
 
    function shareTo(stype){
        var ftit = '';
        var flink = '';
        var lk = '';
        //獲取文章標(biāo)題
        ftit = $('.pctitle').text();
        //獲取網(wǎng)頁(yè)中內(nèi)容的第一張圖片
        flink = $('.pcdetails img').eq(0).attr('src');
        if(typeof flink == 'undefined'){
            flink='';
        }
        //當(dāng)內(nèi)容中沒(méi)有圖片時(shí),設(shè)置分享圖片為網(wǎng)站logo
        if(flink == ''){
            lk = 'http://'+window.location.host+'/static/images/logo.png';
        }
        //如果是上傳的圖片則進(jìn)行絕對(duì)路徑拼接
        if(flink.indexOf('/uploads/') != -1) {
            lk = 'http://'+window.location.host+flink;
        }
        //百度編輯器自帶圖片獲取
        if(flink.indexOf('ueditor') != -1){
            lk = flink;
        }
        //qq空間接口的傳參
        if(stype=='qzone'){
            window.open('https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+document.location.href+'?sharesource=qzone&title='+ftit+'&pics='+lk+'&summary='+document.querySelector('meta[name="description"]').getAttribute('content'));
        }
        //新浪微博接口的傳參
        if(stype=='sina'){
            window.open('http://service.weibo.com/share/share.php?url='+document.location.href+'?sharesource=weibo&title='+ftit+'&pic='+lk+'&appkey=2706825840');
        }
        //qq好友接口的傳參
        if(stype == 'qq'){
            window.open('http://connect.qq.com/widget/shareqq/index.html?url='+document.location.href+'?sharesource=qzone&title='+ftit+'&pics='+lk+'&summary='+document.querySelector('meta[name="description"]').getAttribute('content')+'&desc=php自學(xué)網(wǎng),一個(gè)web開(kāi)發(fā)交流的網(wǎng)站');
        }
        //生成二維碼給微信掃描分享,php生成,也可以用jquery.qrcode.js插件實(shí)現(xiàn)二維碼生成
        if(stype == 'wechat'){
            window.open('http://zixuephp.net/inc/qrcode_img.php?url=http://zixuephp.net/article-1.html');
        }
    }
 
</script>

到了這里,關(guān)于Qrcode前端生成二維碼,列表循環(huán),可以下載分享,附加功能的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(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)文章

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

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

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

    2024年02月01日
    瀏覽(31)
  • 使用jquery.qrcode生成二維碼

    1、首先在頁(yè)面中加入jquery庫(kù)文件和qrcode插件。 2、在頁(yè)面中需要顯示二維碼的地方加入以下代碼: 3、生成二維碼 qrcode支持canvas和table兩種方式進(jìn)行圖片渲染,默認(rèn)使用canvas方式,效率最高,當(dāng)然要瀏覽器支持html5。直接調(diào)用如下 也可以通過(guò)以下方式調(diào)用: 這樣就可以在頁(yè)面

    2024年02月06日
    瀏覽(48)
  • C# QRCode二維碼的解析與生成

    C# QRCode二維碼的解析與生成

    已知一張二維碼圖片,怎么生成一張一模一樣的圖片出來(lái)? 最近有個(gè)項(xiàng)目,需要用到QRCode,之前只做過(guò)Datamatrix格式的,想著應(yīng)該也是差不多的,于是就依葫蘆畫瓢,掏出我的陳年OnBarcode類庫(kù),一通修改,生成了個(gè)嶄新的QRCode,與客戶提供的二維碼圖片一比對(duì),雖然掃出來(lái)內(nèi)

    2024年02月12日
    瀏覽(27)
  • tki-qrcode插件二維碼的生成

    tki-qrcode插件二維碼的生成

    1、全局安裝tki-qrcode插件 2、查看下載插件后的版本信息 3、在頁(yè)面中引入tki-qrcode 4、生成二維碼整體代碼 5、效果展示 此樣式是平時(shí)黑色二維碼樣式,此為打過(guò)馬賽克的二維碼(不打馬賽克博客無(wú)法展示圖片,無(wú)奈(O~O) 注: 二維碼中的內(nèi)容可綁定鏈接和其他內(nèi)容值 根據(jù)自

    2024年02月09日
    瀏覽(29)
  • 詳解Python生成二維碼插件QrCode的使用

    二維碼(QR Code)是一種常見(jiàn)的矩陣型條碼,被廣泛用于掃碼支付、產(chǎn)品標(biāo)識(shí)、活動(dòng)推廣等領(lǐng)域。Python提供了許多第三方庫(kù)用于生成和解析二維碼,其中最常用的是qrcode庫(kù)。本文將介紹如何使用qrcode庫(kù)來(lái)生成二維碼,并提供相應(yīng)的代碼示例和詳細(xì)說(shuō)明。 在開(kāi)始之前,我們需要

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

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

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

    2023年04月12日
    瀏覽(30)
  • 動(dòng)態(tài)二維碼生成器PHP Dynamic QRcode

    動(dòng)態(tài)二維碼生成器PHP Dynamic QRcode

    什么是 PHP Dynamic QRcode ? PHP Dynamic QRcode 是一個(gè)允許生成和保存動(dòng)態(tài)和靜態(tài)二維碼( QR 碼)的應(yīng)用。它具有簡(jiǎn)潔、響應(yīng)靈敏且用戶友好的設(shè)計(jì)。其中包含您網(wǎng)站中可能需要的一般功能,如:記錄管理( CRUD )、安全身份驗(yàn)證、分頁(yè)、過(guò)濾器。 什么是 Dynamic Qr codes ? Dynamic Qr co

    2024年02月11日
    瀏覽(27)
  • vue3 qrcode 生成二維碼展示 親測(cè)可用

    網(wǎng)上找的好多vue3 生成二維碼代碼都不能用,正確辦法如下 安裝 script template

    2024年02月09日
    瀏覽(32)
  • 微信小程序生成二維碼(weapp-qrcode)

    插件 npm 地址:https://www.npmjs.com/package/weapp-qrcode 插件 GitHub 地址:https://github.com/yingye/weapp-qrcode/tree/master 一、引入 1、根據(jù) GitHub 指引將 weapp-qrcode 放到本地 uitl 文件夾下; 2、創(chuàng)建 canvas 3、在 js 文件中引入 weapp-qrcode 以及使用; 這里是添加了 logo 的二維碼;相關(guān)參數(shù)請(qǐng)參考

    2024年02月15日
    瀏覽(41)
  • 微信小程序生成二維碼插件weapp-qrcode.js

    首先創(chuàng)建weapp-qrcode.js文件 然后復(fù)制一下內(nèi)容到weapp-qrcode.js文件 然后在index.wxml文件寫入 在index.js文件寫入 效果如下: ?

    2024年02月12日
    瀏覽(23)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包