Giter VIP home page Giter VIP logo

Comments (6)

yingye avatar yingye commented on May 18, 2024

贴一下必要的代码吧

from weapp-qrcode.

fml077 avatar fml077 commented on May 18, 2024

// util.js文件里方法定义:
/**

  • width:二维码宽度, heigh:二维码高度, domid:二维码DOM元素, text:二维码内容, imgurl:自定义二维码中的图片
    */
    const drawCode = (width, heigh, domid, text, imgurl) => {
    drawQrcode({
    width: width,
    height: heigh,
    canvasId: domid,
    text: text,
    // v1.0.0+版本支持在二维码上绘制图片
    image: {
    imageResource: imgurl,
    dx: 37.5, // 图片x轴偏移量(单位px,下同)
    dy: 37.5, // 图片y轴偏移量
    dWidth: 60, // 图片宽
    dHeight: 60 // 图片高
    }
    })
    }

// index.js文件里 方法调用

// _this.data.giftIcon为图片地址:https://bigshowcdn.cmcm.com/upload/image/20190109/l9HfnArh037998.jpeg
util.drawCode('135', '135', 'myQrcode', _this.data.codeInfo);

//问题:二维码绘制没问题,但是手机上调试二维码上的图片始终显示不出来,微信开发者工具上可以显示

from weapp-qrcode.

yingye avatar yingye commented on May 18, 2024

图片是远程地址的问题,使用本地图片,或者把远程图片保存在本地。

from weapp-qrcode.

fml077 avatar fml077 commented on May 18, 2024

不支持用远程图片地址吗?可不可以做一下兼容呀大佬?我这是详情页图片地址都是从后端拿的url, 很多图片呢保存到本地不实际呀😢

from weapp-qrcode.

yingye avatar yingye commented on May 18, 2024

尝试获取一下图片的临时地址

from weapp-qrcode.

Fantasy77777 avatar Fantasy77777 commented on May 18, 2024

请问解决了吗

from weapp-qrcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.