如何在小程序中快速实现实现环形进度条(4)
发布于 4 年前 作者 dengli 3018 次浏览 来自 分享

更新渲染api,现在支持最新的同层canvas渲染,文档已经更新,只需要更改少量参数即可使用,真香

const mprogress = new MpProgress({
  target: this, // 新增的上下文参数
  canvasId: 'progress',
  canvasSize: {width: 400, height: 400},
  barStyle: [{width: 12, fillStyle: '#f0f0f0'}, {width: 12, fillStyle: [{position: 0, color: '#56B37F'}, {position: 1, color: '#c0e674'}]}]
});
// canvas标签定义发生变化
<canvas class="canvas" type="2d" id="progress"></canvas>

快速安装:

npm i –save mp-progress

详细文档请戳:https://github.com/lucaszhu2zgf/mp-progress

1 回复

楼主 想请教一下 在同一个页面上有多个环形渲染的情况下 性能怎么样

回到顶部