Skip to content

Commit

Permalink
发布 2.4.1 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
youngjuning committed May 4, 2018
1 parent cdaef3c commit 8c3317d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ wx.pro.request({
2. [match(type,str)](./detail/match.md):正则匹配方法
3. initChart(option,echarts):初始化 Echarts 的方法
4. [lazyInitChart(option,echarts,componentId,that)](./detail/lazyInitChart.md):echarts 懒加载模式初始化
5. saveImageToPhotosAlbum(tempFilePath):带有授权解决方案的保存图片到系统相册方法
6. canvasToTempFilePath(canvasContext):把当前画布指定区域的内容导出生成指定大小的图片,并返回文件路径
5. updateChart(chart,option):echats 没有提供 update 的方法,因此我们利用 clear() 和 setOption() api 组合实现了这个功能
6. saveImageToPhotosAlbum(tempFilePath):带有授权解决方案的保存图片到系统相册方法
7. canvasToTempFilePath(canvasContext):把当前画布指定区域的内容导出生成指定大小的图片,并返回文件路径

## TODO

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wx-promise-pro",
"version": "2.4.1-prepare",
"version": "2.4.1",
"description": "强大的、优雅的小程序 Promise 库",
"main": "wxPromise.js",
"scripts": {
Expand Down
11 changes: 11 additions & 0 deletions wxPromise.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ const wxPromise = () => {
})
})
},
/**
* 更新 echarts
* echats 没有提供 update 的方法,因此我们利用 clear() 和 setOption() api 组合实现了这个功能
*/
wx.pro.updateChart = (chart,option) => {
// 在chart.setOption之前用chart.clear来清除之前的图表,否则会出现一个非常奇怪的图表
chart.clear()
// option 是在网络请求之后异步动态获取的
chart.setOption(option)
// 因为不是 dispose,所以不需要重新绑定到this上,也不需要再次返回实例
}

// 保存图片到系统相册。需要用户授权 scope.writePhotosAlbum
wx.pro.saveImageToPhotosAlbum = (tempFilePath) => {
Expand Down

0 comments on commit 8c3317d

Please sign in to comment.