Coder Social home page Coder Social logo

wechatminiappcanvas's Introduction

canvasShareImg

微信小程序 canvas生成分享图 保存到相册发票圈 Demo

思路分解

1. 二维码如果带有参数 就有服务端发送过来 我们需要的只是图片的url;

2. 把用到的图片和文字绘制到画布上 wx.createCanvasContext()

3. 用户点击生成分享图的时候。把画布转成图片wx.canvasToTempFilePath()一直到这里,以上操作对用户都是不可见的,此时生成图片后API会返回图片的路径url,这时可以把拿到的图片url放到一个<image>里展示给用户了;

4. 再来一个按钮把展示的图片调用wx.saveImageToPhotosAlbum()保存到相册中,完结撒花;

更详细的解释见 微信小程序 canvas生成分享图

任何问题欢迎留言

wechatminiappcanvas's People

Contributors

chianz avatar

Watchers

 avatar  avatar

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.