@tarojs/taro 3.5.5 → 3.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/html5.css CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  .h5-marquee {
62
62
  display: inline-block;
63
- width: fill-available;
63
+ width: stretch;
64
64
  }
65
65
 
66
66
  .h5-address {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,8 +21,8 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.5.5",
25
- "@tarojs/runtime": "3.5.5"
24
+ "@tarojs/api": "3.5.6",
25
+ "@tarojs/runtime": "3.5.6"
26
26
  },
27
27
  "peerDependenciesMeta": {
28
28
  "@types/react": {
@@ -126,6 +126,21 @@ declare module '../../index' {
126
126
  }
127
127
  }
128
128
 
129
+ namespace createOffscreenCanvas {
130
+ interface Option {
131
+ /** 创建的离屏 canvas 类型
132
+ * @default: 'webgl'
133
+ */
134
+ type?: 'webgl' | '2d'
135
+ /** 画布高度 */
136
+ height?: number
137
+ /** 画布宽度 */
138
+ width?: number
139
+ /** 在自定义组件下,当前组件实例的 this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
140
+ component?: TaroGeneral.IAnyObject,
141
+ }
142
+ }
143
+
129
144
  /** Canvas 实例,可通过 SelectorQuery 获取。
130
145
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html
131
146
  */
@@ -1705,8 +1720,13 @@ declare module '../../index' {
1705
1720
  /** 创建离屏 canvas 实例
1706
1721
  * @supported weapp
1707
1722
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html
1723
+ *
1724
+ * 有两个版本的写法:
1725
+ *
1726
+ * - createOffscreenCanvas(options) 从 2.16.1 起支持
1727
+ * - createOffscreenCanvas(width, height, this) 从 2.7.0 起支持
1708
1728
  */
1709
- createOffscreenCanvas(): OffscreenCanvas
1729
+ createOffscreenCanvas(options: createOffscreenCanvas.Option): OffscreenCanvas
1710
1730
 
1711
1731
  /** 创建 canvas 的绘图上下文 [CanvasContext](/docs/apis/canvas/CanvasContext) 对象
1712
1732
  *
@@ -79,9 +79,9 @@ declare module '../../index' {
79
79
  /** 详细地址 */
80
80
  address: string
81
81
  /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
82
- latitude: string
82
+ latitude: number
83
83
  /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
84
- longitude: string
84
+ longitude: number
85
85
  }
86
86
  }
87
87
 
@@ -109,9 +109,9 @@ declare module '../../index' {
109
109
  /** 详细地址 */
110
110
  address: string
111
111
  /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
112
- latitude: string
112
+ latitude: number
113
113
  /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
114
- longitude: string
114
+ longitude: number
115
115
  /** 位置名称 */
116
116
  name: string
117
117
  /** 调用结果 */
@@ -202,9 +202,9 @@ declare module '../../index' {
202
202
 
203
203
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
204
204
  /** 纬度,范围为 -90~90,负数表示南纬 */
205
- latitude: string
205
+ latitude: number
206
206
  /** 经度,范围为 -180~180,负数表示西经 */
207
- longitude: string
207
+ longitude: number
208
208
  }
209
209
  }
210
210
 
@@ -215,7 +215,7 @@ declare module '../../index' {
215
215
  */
216
216
  stopLocationUpdate(option?: stopLocationUpdate.Option): void
217
217
 
218
- /** 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权](./apis/open-api/authorize/authorize.md#后台定位)。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
218
+ /** 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权](../open-api/authorize/authorize.md#后台定位)。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
219
219
  *
220
220
  * **注意**
221
221
  * - 安卓微信7.0.6版本,iOS 7.0.5版本起支持该接口
@@ -260,6 +260,41 @@ declare module '../../index' {
260
260
  }
261
261
  }
262
262
 
263
+ namespace cropImage {
264
+ interface Option {
265
+ /** 图片路径,图片的路径,支持本地路径、代码包路径 */
266
+ src: string
267
+ /** 裁剪比例 */
268
+ cropScale: keyof CropScale
269
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
270
+ complete?: (res: TaroGeneral.CallbackResult) => void
271
+ /** 接口调用失败的回调函数 */
272
+ fail?: (res: TaroGeneral.CallbackResult) => void
273
+ /** 接口调用成功的回调函数 */
274
+ success?: (result: SuccessCallbackResult) => void
275
+ }
276
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
277
+ /** 剪裁后图片的临时文件路径 (本地路径) */
278
+ tempFilePath: string
279
+ }
280
+ interface CropScale {
281
+ /** 宽高比为1比1 */
282
+ '1:1'
283
+ /** 宽高比为3比4 */
284
+ '3:4'
285
+ /** 宽高比为4比3 */
286
+ '4:3'
287
+ /** 宽高比为4比5 */
288
+ '4:5'
289
+ /** 宽高比为5比4 */
290
+ '5:4'
291
+ /** 宽高比为6比19 */
292
+ '6:19'
293
+ /** 宽高比为19比6 */
294
+ '19:6'
295
+ }
296
+ }
297
+
263
298
  interface TaroStatic {
264
299
  /** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
265
300
  * @supported weapp, rn, alipay, swan, tt
@@ -385,5 +420,23 @@ declare module '../../index' {
385
420
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
386
421
  */
387
422
  chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
423
+
424
+ /**
425
+ * 裁剪图片接口
426
+ * @supported weapp
427
+ * @example
428
+ * ```tsx
429
+ * Taro.cropImage({
430
+ * src: '', // 图片路径
431
+ * cropScale: '1:1', // 裁剪比例
432
+ * success: function (res) {
433
+ * // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
434
+ * var tempFilePaths = res.tempFilePaths
435
+ * }
436
+ * })
437
+ * ```
438
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.cropImage.html
439
+ */
440
+ cropImage(option: cropImage.Option): Promise<cropImage.SuccessCallbackResult>
388
441
  }
389
442
  }
@@ -87,57 +87,104 @@ declare module '../../index' {
87
87
 
88
88
  namespace openBusinessView {
89
89
  /**
90
- * 业务参数:需要传递给支付分的业务数据
91
- * @interface ExtraData
90
+ * wxpayScoreEnable 业务参数
91
+ * @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_9.shtml
92
92
  */
93
- interface ExtraData {
93
+ interface ScoreEnableExtraData {
94
+ /**
95
+ * 用于跳转到微信侧小程序授权数据,跳转到微信侧小程序传入,有效期为1小时;apply_permissions_token可以从[《商户预授权API》](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_2.shtml)接口的返回参数中获取。
96
+ * 示例值:1230000109
97
+ * @type {string[1,2048]}
98
+ */
99
+ apply_permissions_token: string
100
+ }
101
+ /**
102
+ * wxpayScoreUse 业务参数
103
+ * @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_13.shtml
104
+ */
105
+ interface ScoreUsedExtraData {
106
+ /**
107
+ * 商户号:微信支付分配的商户号。
108
+ * 示例值:1230000109
109
+ * @type {string[1,32]}
110
+ */
111
+ mch_id: string
112
+ /**
113
+ * 可在【创建订单】接口的返回字段package中获取。
114
+ * 示例值:XXXXXXXX
115
+ * @type {string[1,128]}
116
+ */
117
+ package: string
118
+ /**
119
+ * 时间戳:生成签名时间戳,单位秒。
120
+ * 示例值:1530097563
121
+ * @type {string[1,32]}
122
+ */
123
+ timestamp: string
124
+ /**
125
+ * 随机字符串:生成签名随机串。由数字、大小写字母组成,长度不超过32位。
126
+ * 示例值:zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2
127
+ * @type {string[1,32]}
128
+ */
129
+ nonce_str: string
130
+ /**
131
+ * 签名方式:签名类型,仅支持HMAC-SHA256。
132
+ * 示例值:HMAC-SHA256
133
+ * @type {string[1,32]}
134
+ */
135
+ sign_type: string
136
+ /**
137
+ * 签名:使用字段mch_id、service_id、out_order_no、timestamp、nonce_str、sign_type按照签名生成算法计算得出的签名值。
138
+ * 示例值:029B52F67573D7E3BE74904BF9AEA
139
+ * @type {string[1,64]}
140
+ */
141
+ sign: string
142
+ }
143
+ /**
144
+ * wxpayScoreDetail 业务参数
145
+ * @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_25.shtml
146
+ */
147
+ interface ScoreDetailExtraData {
94
148
  /**
95
149
  * 商户号:微信支付分配的商户号。
96
150
  * 示例值:1230000109
97
151
  * @type {string[1,32]}
98
- * @memberof ExtraData
99
152
  */
100
153
  mch_id: string
101
154
  /**
102
155
  * 服务ID
103
156
  * 示例值:88888888000011
104
157
  * @type {string[1,32]}
105
- * @memberof ExtraData
106
158
  */
107
159
  service_id: string
108
160
  /**
109
161
  * 商户服务订单号:商户系统内部服务订单号(不是交易单号)。
110
162
  * 示例值:234323JKHDFE1243252
111
163
  * @type {string[1,32]}
112
- * @memberof ExtraData
113
164
  */
114
165
  out_order_no: string
115
166
  /**
116
167
  * 时间戳:生成签名时间戳,单位秒。
117
168
  * 示例值:1530097563
118
169
  * @type {string[1,32]}
119
- * @memberof ExtraData
120
170
  */
121
171
  timestamp: string
122
172
  /**
123
173
  * 随机字符串:生成签名随机串。由数字、大小写字母组成,长度不超过32位。
124
174
  * 示例值:zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2
125
175
  * @type {string[1,32]}
126
- * @memberof ExtraData
127
176
  */
128
177
  nonce_str: string
129
178
  /**
130
179
  * 签名方式:签名类型,仅支持HMAC-SHA256。
131
180
  * 示例值:HMAC-SHA256
132
181
  * @type {string[1,32]}
133
- * @memberof ExtraData
134
182
  */
135
183
  sign_type: string
136
184
  /**
137
185
  * 签名:使用字段mch_id、service_id、out_order_no、timestamp、nonce_str、sign_type按照签名生成算法计算得出的签名值。
138
186
  * 示例值:029B52F67573D7E3BE74904BF9AEA
139
187
  * @type {string[1,64]}
140
- * @memberof ExtraData
141
188
  */
142
189
  sign: string
143
190
  }
@@ -149,8 +196,9 @@ declare module '../../index' {
149
196
  * @type {string[1,16]}
150
197
  * @memberof Option
151
198
  */
152
- businessType: string
153
- extraData: ExtraData
199
+ businessType: 'wxpayScoreEnable' | 'wxpayScoreUse' | 'wxpayScoreDetail' | string
200
+ /** 业务参数:需要传递给支付分的业务数据 */
201
+ extraData: ScoreEnableExtraData | ScoreUsedExtraData | ScoreDetailExtraData
154
202
  /** 接口调用成功的回调函数 */
155
203
  success?: (res: TaroGeneral.CallbackResult) => void
156
204
  /** 接口调用失败的回调函数 */
@@ -259,7 +307,6 @@ declare module '../../index' {
259
307
  * //引导用户升级微信版本
260
308
  * }
261
309
  * ```
262
- *
263
310
  * @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_25.shtml
264
311
  */
265
312
  openBusinessView(option: openBusinessView.Option): Promise<TaroGeneral.CallbackResult>
@@ -44,9 +44,10 @@ declare module '../../index' {
44
44
  /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
45
45
  withShareTicket?: boolean
46
46
  /** QQ小程序分享功能,支持分享到QQ、QQ空间、微信好友、微信朋友圈
47
- * 支持的值: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
48
- * @supported qq
49
- */
47
+ * @supported weapp, qq
48
+ * @qq QQ支持的值: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
49
+ * @weapp 微信支持:['wechatFriends', 'wechatMoment'] / ['shareAppMessage', 'shareTimeline']
50
+ */
50
51
  showShareItems?: string[]
51
52
  }
52
53
  }
@@ -178,7 +179,7 @@ declare module '../../index' {
178
179
  * ```
179
180
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html
180
181
  */
181
- updateShareMenu(option: updateShareMenu.Option): Promise<TaroGeneral.CallbackResult>
182
+ updateShareMenu (option: updateShareMenu.Option): Promise<TaroGeneral.CallbackResult>
182
183
 
183
184
  /** 显示当前页面的转发按钮
184
185
  * @supported weapp, qq, tt
@@ -190,7 +191,7 @@ declare module '../../index' {
190
191
  * ```
191
192
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html
192
193
  */
193
- showShareMenu(option: showShareMenu.Option): Promise<TaroGeneral.CallbackResult>
194
+ showShareMenu (option: showShareMenu.Option): Promise<TaroGeneral.CallbackResult>
194
195
 
195
196
  /** 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载
196
197
  * @supported weapp
@@ -207,7 +208,7 @@ declare module '../../index' {
207
208
  * ```
208
209
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareImageMenu.html
209
210
  */
210
- showShareImageMenu(option: showShareImageMenu.Option): Promise<TaroGeneral.CallbackResult>
211
+ showShareImageMenu (option: showShareImageMenu.Option): Promise<TaroGeneral.CallbackResult>
211
212
 
212
213
  /** 转发视频到聊天
213
214
  * @supported weapp
@@ -242,13 +243,13 @@ declare module '../../index' {
242
243
  * ```
243
244
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.shareVideoMessage.html
244
245
  */
245
- shareVideoMessage(option: shareVideoMessage.Option): Promise<TaroGeneral.CallbackResult>
246
+ shareVideoMessage (option: shareVideoMessage.Option): Promise<TaroGeneral.CallbackResult>
246
247
 
247
248
  /** 转发文件到聊天
248
249
  * @supported weapp
249
250
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.shareFileMessage.html
250
251
  */
251
- shareFileMessage(option: shareFileMessage.Option): Promise<TaroGeneral.CallbackResult>
252
+ shareFileMessage (option: shareFileMessage.Option): Promise<TaroGeneral.CallbackResult>
252
253
 
253
254
  /** 监听用户点击右上角菜单的「复制链接」按钮时触发的事件
254
255
  *
@@ -256,7 +257,7 @@ declare module '../../index' {
256
257
  * @supported weapp
257
258
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.onCopyUrl.html
258
259
  */
259
- onCopyUrl(
260
+ onCopyUrl (
260
261
  /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
261
262
  callback: onCopyUrl.Callback,
262
263
  ): void
@@ -267,7 +268,7 @@ declare module '../../index' {
267
268
  * @supported weapp
268
269
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.offCopyUrl.html
269
270
  */
270
- offCopyUrl(
271
+ offCopyUrl (
271
272
  /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
272
273
  callback: onCopyUrl.Callback,
273
274
  ): void
@@ -280,7 +281,7 @@ declare module '../../index' {
280
281
  * ```
281
282
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html
282
283
  */
283
- hideShareMenu(option?: hideShareMenu.Option): Promise<TaroGeneral.CallbackResult>
284
+ hideShareMenu (option?: hideShareMenu.Option): Promise<TaroGeneral.CallbackResult>
284
285
 
285
286
  /** 获取转发详细信息
286
287
  *
@@ -297,7 +298,7 @@ declare module '../../index' {
297
298
  * ```
298
299
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html
299
300
  */
300
- getShareInfo(option: getShareInfo.Option): Promise<getShareInfo.SuccessCallbackResult>
301
+ getShareInfo (option: getShareInfo.Option): Promise<getShareInfo.SuccessCallbackResult>
301
302
 
302
303
  /** 验证私密消息
303
304
  * @supported weapp
@@ -322,6 +323,6 @@ declare module '../../index' {
322
323
  * ```
323
324
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.authPrivateMessage.html
324
325
  */
325
- authPrivateMessage(option: authPrivateMessage.Option): Promise<authPrivateMessage.SuccessCallbackResult>
326
+ authPrivateMessage (option: authPrivateMessage.Option): Promise<authPrivateMessage.SuccessCallbackResult>
326
327
  }
327
328
  }