@tarojs/components 3.4.0 → 3.4.3

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.
Files changed (88) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/taro-components.cjs.js +1 -1
  3. package/dist/cjs/taro-input-core.cjs.entry.js +25 -16
  4. package/dist/cjs/taro-pull-to-refresh.cjs.entry.js +12 -3
  5. package/dist/cjs/taro-scroll-view-core.cjs.entry.js +3 -3
  6. package/dist/cjs/taro-tabbar.cjs.entry.js +3 -2
  7. package/dist/collection/components/input/input.js +40 -22
  8. package/dist/collection/components/pull-to-refresh/pull-to-refresh.js +11 -2
  9. package/dist/collection/components/pull-to-refresh/style/index.css +1 -0
  10. package/dist/collection/components/scroll-view/scroll-view.js +3 -3
  11. package/dist/collection/components/tabbar/style/index.css +3 -1
  12. package/dist/collection/components/tabbar/tabbar.js +2 -1
  13. package/dist/esm/loader.js +1 -1
  14. package/dist/esm/taro-components.js +1 -1
  15. package/dist/esm/taro-input-core.entry.js +25 -16
  16. package/dist/esm/taro-pull-to-refresh.entry.js +12 -3
  17. package/dist/esm/taro-scroll-view-core.entry.js +3 -3
  18. package/dist/esm/taro-tabbar.entry.js +3 -2
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/taro-components.js +1 -1
  21. package/dist/esm-es5/taro-input-core.entry.js +1 -1
  22. package/dist/esm-es5/taro-pull-to-refresh.entry.js +1 -1
  23. package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
  24. package/dist/esm-es5/taro-tabbar.entry.js +1 -1
  25. package/dist/taro-components/p-2b0d5c90.system.entry.js +1 -0
  26. package/dist/taro-components/p-33ee636a.system.js +1 -1
  27. package/dist/taro-components/p-4e54216b.entry.js +1 -0
  28. package/dist/taro-components/p-5ae86835.system.entry.js +1 -0
  29. package/dist/taro-components/{p-dd34408a.entry.js → p-6de12779.entry.js} +1 -1
  30. package/dist/taro-components/p-71e14298.entry.js +1 -0
  31. package/dist/taro-components/p-8486c251.system.entry.js +1 -0
  32. package/dist/taro-components/{p-6965567d.entry.js → p-cc818a13.entry.js} +1 -1
  33. package/dist/taro-components/{p-13c1404f.system.entry.js → p-fd0d1168.system.entry.js} +1 -1
  34. package/dist/taro-components/taro-components.esm.js +1 -1
  35. package/dist/types/components/input/input.d.ts +3 -3
  36. package/dist/types/components.d.ts +1 -0
  37. package/dist-h5/vue/components/picker.js +2 -1
  38. package/package.json +4 -4
  39. package/types/Ad.d.ts +22 -10
  40. package/types/Audio.d.ts +25 -5
  41. package/types/Button.d.ts +112 -23
  42. package/types/Camera.d.ts +11 -11
  43. package/types/Canvas.d.ts +14 -1
  44. package/types/Checkbox.d.ts +65 -1
  45. package/types/CoverImage.d.ts +48 -6
  46. package/types/CoverView.d.ts +51 -8
  47. package/types/Editor.d.ts +57 -0
  48. package/types/Form.d.ts +33 -2
  49. package/types/FunctionalPageNavigator.d.ts +4 -4
  50. package/types/Icon.d.ts +17 -1
  51. package/types/Image.d.ts +24 -4
  52. package/types/Input.d.ts +66 -5
  53. package/types/KeyboardAccessory.d.ts +2 -1
  54. package/types/Label.d.ts +18 -4
  55. package/types/LivePlayer.d.ts +17 -11
  56. package/types/LivePusher.d.ts +21 -15
  57. package/types/Map.d.ts +59 -5
  58. package/types/MatchMedia.d.ts +24 -5
  59. package/types/MovableArea.d.ts +9 -3
  60. package/types/MovableView.d.ts +20 -6
  61. package/types/Navigator.d.ts +7 -7
  62. package/types/OfficialAccount.d.ts +4 -10
  63. package/types/OpenData.d.ts +11 -5
  64. package/types/PageContainer.d.ts +12 -6
  65. package/types/Picker.d.ts +66 -3
  66. package/types/PickerView.d.ts +66 -2
  67. package/types/PickerViewColumn.d.ts +1 -1
  68. package/types/Progress.d.ts +12 -1
  69. package/types/Radio.d.ts +77 -1
  70. package/types/RichText.d.ts +33 -1
  71. package/types/ScrollView.d.ts +91 -9
  72. package/types/ShareElement.d.ts +1 -1
  73. package/types/Slider.d.ts +14 -1
  74. package/types/Swiper.d.ts +26 -1
  75. package/types/SwiperItem.d.ts +28 -3
  76. package/types/Switch.d.ts +21 -3
  77. package/types/Text.d.ts +38 -1
  78. package/types/Textarea.d.ts +17 -1
  79. package/types/Video.d.ts +50 -30
  80. package/types/View.d.ts +33 -1
  81. package/types/VoipRoom.d.ts +10 -11
  82. package/types/WebView.d.ts +7 -1
  83. package/types/common.d.ts +1 -1
  84. package/dist/taro-components/p-04818461.system.entry.js +0 -1
  85. package/dist/taro-components/p-56618f09.entry.js +0 -1
  86. package/dist/taro-components/p-665e8461.system.entry.js +0 -1
  87. package/dist/taro-components/p-6fcaadc7.entry.js +0 -1
  88. package/dist/taro-components/p-bb0d4567.system.entry.js +0 -1
package/types/Editor.d.ts CHANGED
@@ -79,6 +79,63 @@ declare namespace EditorProps {
79
79
  * *编辑器内支持部分 HTML 标签和内联样式,不支持 **class** 和 **id***
80
80
  * @classification forms
81
81
  * @supported weapp
82
+ * @example_react
83
+ * ```tsx
84
+ * class App extends Components {
85
+ * state = {
86
+ * placeholder: '来,输入隔壁的名字试试...'
87
+ * }
88
+ *
89
+ * editorReady = e => {
90
+ * Taro.createSelectorQuery().select('#editor').context((res) => {
91
+ * this.editorCtx = res.context
92
+ * }).exec()
93
+ * }
94
+ *
95
+ * undo = e => {
96
+ * this.editorCtx.undo()
97
+ * }
98
+ *
99
+ * render () {
100
+ * return (
101
+ * <View>
102
+ * <Editor id='editor' className='editor' placeholder={this.state.placeholder} onReady={this.editorReady}></Editor>
103
+ * <Button type='warn' onClick={this.undo}>撤销</Button>
104
+ * </View>
105
+ * )
106
+ * }
107
+ * }
108
+ * ```
109
+ * @example_vue
110
+ * ```html
111
+ * <template>
112
+ * <view class="container">
113
+ * <editor id="editor" class="editor" :placeholder="placeholder" `@ready="editorReady"></editor>
114
+ * <button type="warn" `@tap="undo">撤销</button>
115
+ * </view>
116
+ * </template>
117
+ *
118
+ * <script>
119
+ * import Taro from '@tarojs/taro'
120
+ * export default {
121
+ * data() {
122
+ * return {
123
+ * placeholder: '来,输入隔壁的名字试试...'
124
+ * }
125
+ * },
126
+ * methods: {
127
+ * editorReady() {
128
+ * Taro.createSelectorQuery().select('#editor').context((res) => {
129
+ * this.editorCtx = res.context
130
+ * }).exec()
131
+ * },
132
+ * undo() {
133
+ * this.editorCtx.undo()
134
+ * }
135
+ * }
136
+ * }
137
+ * </script>
138
+ * ```
82
139
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/editor.html
83
140
  */
84
141
  declare const Editor: ComponentType<EditorProps>
package/types/Form.d.ts CHANGED
@@ -20,7 +20,7 @@ interface FormProps extends StandardProps {
20
20
 
21
21
  /** 携带 form 中的数据触发 submit 事件
22
22
  * event.detail = { value : {'name': 'value'} , formId: '' }
23
- * @supported weapp
23
+ * @supported weapp, rn
24
24
  */
25
25
  onSubmit?: CommonEventFunction<FormProps.onSubmitEventDetail>
26
26
 
@@ -50,7 +50,7 @@ declare namespace FormProps {
50
50
  * 当点击 form 表单中 form-type 为 submit 的 button 组件时,会将表单组件中的 value 值进行提交,需要在表单组件中加上 name 来作为 key。
51
51
  * @classification forms
52
52
  * @supported weapp, h5, rn
53
- * @example
53
+ * @example_react
54
54
  * ```tsx
55
55
  * class App extends Component {
56
56
  *
@@ -73,6 +73,37 @@ declare namespace FormProps {
73
73
  * }
74
74
  * }
75
75
  * ```
76
+ * @example_vue
77
+ * ```html
78
+ * <template>
79
+ * <form `@submit="formSubmit" `@reset="formReset" >
80
+ * <view class="taro-example-body">
81
+ * <switch name="switch" class="form-switch"></Switch>
82
+ * </view>
83
+ * <view class="taro-example-btns">
84
+ * <button form-type="submit">Submit</button>
85
+ * <button type="default" form-type="reset">Reset</button>
86
+ * </view>
87
+ * </form>
88
+ * </template>
89
+ *
90
+ * <script>
91
+ * export default {
92
+ * data() {
93
+ * return {}
94
+ * },
95
+ * methods: {
96
+ * formSubmit (e) {
97
+ * console.log(e)
98
+ * },
99
+ *
100
+ * formReset (e) {
101
+ * console.log(e)
102
+ * }
103
+ * }
104
+ * }
105
+ * </script>
106
+ * ```
76
107
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/form.html
77
108
  */
78
109
  declare const Form: ComponentType<FormProps>
@@ -6,12 +6,12 @@ interface FunctionalPageNavigatorProps extends StandardProps {
6
6
  * @default "release"
7
7
  * @supported weapp
8
8
  */
9
- version?: keyof FunctionalPageNavigatorProps.version
9
+ version?: keyof FunctionalPageNavigatorProps.Version
10
10
 
11
11
  /** 要跳转到的功能页
12
12
  * @supported weapp
13
13
  */
14
- name?: keyof FunctionalPageNavigatorProps.name
14
+ name?: keyof FunctionalPageNavigatorProps.Name
15
15
 
16
16
  /** 功能页参数,参数格式与具体功能页相关
17
17
  * @supported weapp
@@ -36,7 +36,7 @@ interface FunctionalPageNavigatorProps extends StandardProps {
36
36
 
37
37
  declare namespace FunctionalPageNavigatorProps {
38
38
  /** version 的合法值 */
39
- interface version {
39
+ interface Version {
40
40
  /** 开发版 */
41
41
  develop
42
42
  /** 体验版 */
@@ -45,7 +45,7 @@ declare namespace FunctionalPageNavigatorProps {
45
45
  release
46
46
  }
47
47
  /** name 的合法值 */
48
- interface name {
48
+ interface Name {
49
49
  /** [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html) */
50
50
  loginAndGetUserInfo
51
51
  /** [支付功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/request-payment.html) */
package/types/Icon.d.ts CHANGED
@@ -50,7 +50,7 @@ declare namespace IconProps {
50
50
  /** 图标。组件属性的长度单位默认为 px
51
51
  * @classification base
52
52
  * @supported weapp, swan, alipay, tt, h5, rn
53
- * @example
53
+ * @example_react
54
54
  * ```tsx
55
55
  * export default class PageView extends Component {
56
56
  * constructor() {
@@ -76,6 +76,22 @@ declare namespace IconProps {
76
76
  * }
77
77
  * }
78
78
  * ```
79
+ * @example_vue
80
+ * <template>
81
+ * <view class="components-page">
82
+ * <icon size="60" type="success" />
83
+ * <icon size="60" type="info" />
84
+ * <icon size="60" type="warn" color="#ccc" />
85
+ * <icon size="60" type="warn" />
86
+ * <icon size="60" type="waiting" />
87
+ * <icon size="20" type="success_no_circle" />
88
+ * <icon size="20" type="warn" />
89
+ * <icon size="20" type="success" />
90
+ * <icon size="20" type="download" />
91
+ * <icon size="20" type="clear" color="red" />
92
+ * <icon size="20" type="search" />
93
+ * </view>
94
+ * </template>
79
95
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/icon.html
80
96
  */
81
97
  declare const Icon: ComponentType<IconProps>
package/types/Image.d.ts CHANGED
@@ -12,7 +12,7 @@ interface ImageProps extends StandardProps {
12
12
  * @supported weapp, h5, rn, swan, alipay, tt
13
13
  * @rn 部分支持 scaleToFill, aspectFit, aspectFill, widthFix
14
14
  */
15
- mode?: keyof ImageProps.mode
15
+ mode?: keyof ImageProps.Mode
16
16
 
17
17
  /** 默认不解析 webP 格式,只支持网络资源
18
18
  * @default false
@@ -28,7 +28,7 @@ interface ImageProps extends StandardProps {
28
28
 
29
29
  /** 图片懒加载。只针对 page 与 scroll-view 下的 image 有效
30
30
  * @default false
31
- * @supported weapp, swan, alipay, tt
31
+ * @supported weapp, swan, alipay, tt, h5
32
32
  */
33
33
  lazyLoad?: boolean
34
34
 
@@ -53,11 +53,16 @@ interface ImageProps extends StandardProps {
53
53
  * @supported h5
54
54
  */
55
55
  imgProps?: ImgHTMLAttributes<HTMLImageElement>
56
+
57
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
58
+ * @supported h5
59
+ */
60
+ nativeProps?: Record<string, unknown>
56
61
  }
57
62
 
58
63
  declare namespace ImageProps {
59
64
  /** mode 的合法值 */
60
- interface mode {
65
+ interface Mode {
61
66
  /** 缩放模式,不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 */
62
67
  scaleToFill
63
68
  /** 缩放模式,保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来。 */
@@ -104,7 +109,7 @@ declare namespace ImageProps {
104
109
  * **Note:** 为实现小程序的 `mode` 特性,在 H5 组件中使用一个 `div` 容器来对内部的 `img` 进行展示区域的裁剪,因此请勿使用元素选择器来重置 `img` 的样式!
105
110
  * @classification media
106
111
  * @supported weapp, h5, rn, swan, alipay, tt
107
- * @example
112
+ * @example_react
108
113
  * ```tsx
109
114
  * export default class PageView extends Component {
110
115
  * constructor() {
@@ -127,6 +132,21 @@ declare namespace ImageProps {
127
132
  * }
128
133
  * }
129
134
  * ```
135
+ * @example_vue
136
+ * ```html
137
+ * <template>
138
+ * <view class="components-page">
139
+ * <image
140
+ * style="width: 300px;height: 100px;background: #fff;"
141
+ * src="nerv_logo.png"
142
+ * />
143
+ * <image
144
+ * style="width: 300px;height: 100px;background: #fff;"
145
+ * src="https://camo.githubusercontent.com/3e1b76e514b895760055987f164ce6c95935a3aa/687474703a2f2f73746f726167652e333630627579696d672e636f6d2f6d74642f686f6d652f6c6f676f2d3278313531333833373932363730372e706e67"
146
+ * />
147
+ * </view>
148
+ * </template>
149
+ * ```
130
150
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/image.html
131
151
  */
132
152
  declare const Image: ComponentType<ImageProps>
package/types/Input.d.ts CHANGED
@@ -12,7 +12,7 @@ interface InputProps extends StandardProps, FormItemProps {
12
12
  * @supported weapp, h5, rn
13
13
  * @rn 部分支持
14
14
  */
15
- type?: 'text' | 'number' | 'idcard' | 'digit'
15
+ type?: 'text' | 'number' | 'idcard' | 'digit' | 'safe-password' | 'nickname'
16
16
 
17
17
  /** 是否是密码类型
18
18
  * @supported weapp, h5, rn
@@ -63,7 +63,6 @@ interface InputProps extends StandardProps, FormItemProps {
63
63
  */
64
64
  focus?: boolean
65
65
 
66
-
67
66
  /** 设置键盘右下角按钮的文字
68
67
  * @default done
69
68
  * @supported weapp, rn
@@ -112,6 +111,41 @@ interface InputProps extends StandardProps, FormItemProps {
112
111
  */
113
112
  alwaysEmbed?: boolean
114
113
 
114
+ /**
115
+ * 安全键盘加密公钥的路径,只支持包内路径
116
+ * @supported weapp
117
+ */
118
+ safePasswordCertPath?: string
119
+
120
+ /**
121
+ * 安全键盘输入密码长度
122
+ * @supported weapp
123
+ */
124
+ safePasswordLength?: number
125
+
126
+ /**
127
+ * 安全键盘加密时间戳
128
+ * @supported weapp
129
+ */
130
+ safePasswordTimeStamp?: number
131
+
132
+ /**
133
+ * 安全键盘加密盐值
134
+ * @supported weapp
135
+ */
136
+ safePasswordNonce?: string
137
+ /**
138
+ * 安全键盘计算hash盐值,若指定custom-hash 则无效
139
+ * @supported weapp
140
+ */
141
+ safePasswordSalt?: string
142
+
143
+ /**
144
+ * 安全键盘计算hash的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))`
145
+ * @supported weapp
146
+ */
147
+ safePasswordCustomHash?: string
148
+
115
149
  /**
116
150
  * 当 type 为 number, digit, idcard 数字键盘是否随机排列
117
151
  * @default false
@@ -147,7 +181,7 @@ interface InputProps extends StandardProps, FormItemProps {
147
181
  *
148
182
  * event.detail = {value: value}
149
183
  * @supported weapp, rn
150
- * @h5 借用[Form 组件](form.html)的`onSubmit`事件来替代
184
+ * @h5 借用[Form 组件](./form)的`onSubmit`事件来替代
151
185
  */
152
186
  onConfirm?: CommonEventFunction<InputProps.inputValueEventDetail>
153
187
 
@@ -157,9 +191,15 @@ interface InputProps extends StandardProps, FormItemProps {
157
191
  * @supported weapp
158
192
  */
159
193
  onKeyboardHeightChange?: CommonEventFunction<InputProps.onKeyboardHeightChangeEventDetail>
194
+
195
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
196
+ * @supported h5
197
+ */
198
+ nativeProps?: Record<string, unknown>
160
199
  }
161
200
 
162
201
  declare namespace InputProps {
202
+ /** > 注意:React-Native 端 `inputEventDetail` 仅实现参数 `value`,若需实时获取光标位置则可通过 [`onSelectionChange`](https://reactnative.dev/docs/textinput#onselectionchange) 实现。 */
163
203
  interface inputEventDetail {
164
204
  /** 输入值 */
165
205
  value: string
@@ -190,7 +230,7 @@ declare namespace InputProps {
190
230
  /** 输入框。该组件是原生组件,使用时请注意相关限制
191
231
  * @classification forms
192
232
  * @supported weapp, h5, rn
193
- * @example
233
+ * @example_react
194
234
  * ```tsx
195
235
  * class App extends Component {
196
236
  *
@@ -204,7 +244,7 @@ declare namespace InputProps {
204
244
  * <Text>数字输入的 input</Text>
205
245
  * <Input type='number' placeholder='这是一个数字输入框'/>
206
246
  * <Text>密码输入的 input</Text>
207
- * <Input type='text' password placeholder='这是一个密码输入框'/>
247
+ * <Input type='password' password placeholder='这是一个密码输入框'/>
208
248
  * <Text>带小数点的 input</Text>
209
249
  * <Input type='digit' placeholder='带小数点的数字键盘'/>
210
250
  * <Text>身份证输入的 input</Text>
@@ -216,6 +256,27 @@ declare namespace InputProps {
216
256
  * }
217
257
  * }
218
258
  * ```
259
+ * @example_vue
260
+ * ```html
261
+ * <template>
262
+ * <view class="example-body">
263
+ * <text>可以自动聚焦的 input</text>
264
+ * <input type="text" placeholder="将会获取焦点" :focus="true" />
265
+ * <text>控制最大输入长度的 input</text>
266
+ * <input type="text" placeholder="最大输入长度为 10" maxlength="10"/>
267
+ * <text>数字输入的 input</text>
268
+ * <input type="number" placeholder="这是一个数字输入框"/>
269
+ * <text>密码输入的 input</text>
270
+ * <input type="password" :password="true" placeholder="这是一个密码输入框"/>
271
+ * <text>带小数点的 input</text>
272
+ * <input type="digit" placeholder="带小数点的数字键盘"/>
273
+ * <text>身份证输入的 input</text>
274
+ * <input type="idcard" placeholder="身份证输入键盘"/>
275
+ * <text>控制占位符颜色的 input</text>
276
+ * <input type="text" placeholder="占位符字体是红色的" placeholder-style="color:red;"/>
277
+ * </view>
278
+ * </template>
279
+ * ```
219
280
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/input.html
220
281
  */
221
282
  declare const Input: ComponentType<InputProps>
@@ -1,6 +1,7 @@
1
1
  import { ComponentType } from 'react'
2
- import { StandardProps, CommonEventFunction } from './common'
2
+ import { StandardProps } from './common'
3
3
 
4
+ /** @ignore */
4
5
  type KeyboardAccessoryProps = StandardProps
5
6
 
6
7
  /** 设置 input / textarea 聚焦时键盘上方 cover-view / cover-image 工具栏视图
package/types/Label.d.ts CHANGED
@@ -3,8 +3,7 @@ import { StandardProps } from './common'
3
3
 
4
4
  interface LabelProps extends StandardProps {
5
5
 
6
- /** 绑定控件的 id
7
- */
6
+ /** 绑定控件的 id */
8
7
  for?: string
9
8
  }
10
9
 
@@ -12,8 +11,8 @@ interface LabelProps extends StandardProps {
12
11
  *
13
12
  * 使用for属性找到对应的id,或者将控件放在该标签下,当点击时,就会触发对应的控件。 for优先级高于内部控件,内部有多个控件的时候默认触发第一个控件。 目前可以绑定的控件有:button, checkbox, radio, switch。
14
13
  * @classification forms
15
- * @supported weapp, swan, alipay, tt, h5
16
- * @example
14
+ * @supported weapp, swan, alipay, tt, h5, rn
15
+ * @example_react
17
16
  * ```tsx
18
17
  * class App extends Components {
19
18
  *
@@ -33,6 +32,21 @@ interface LabelProps extends StandardProps {
33
32
  * }
34
33
  * }
35
34
  * ```
35
+ * @example_vue
36
+ * ```html
37
+ * <template>
38
+ * <radio-group>
39
+ * <label class="example-body__label" for="1" key="1">
40
+ * <radio id="1" value="USA" />
41
+ * USA
42
+ * </label>
43
+ * <label class="example-body__label" for="2" key="2">
44
+ * <radio id="2" value="CHN" :checked="true" />
45
+ * CHN
46
+ * </label>
47
+ * </radio-group>
48
+ * </template>
49
+ * ```
36
50
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/label.html
37
51
  */
38
52
  declare const Label: ComponentType<LabelProps>
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from 'react'
2
- import { StandardProps, CommonEventFunction, netStatus } from './common'
2
+ import { StandardProps, CommonEventFunction, NetStatus } from './common'
3
3
 
4
4
  interface LivePlayerProps extends StandardProps {
5
5
  /** 音视频地址。目前仅支持 flv, rtmp 格式
@@ -11,7 +11,7 @@ interface LivePlayerProps extends StandardProps {
11
11
  * @default "live"
12
12
  * @supported weapp
13
13
  */
14
- mode?: keyof LivePlayerProps.mode
14
+ mode?: keyof LivePlayerProps.Mode
15
15
 
16
16
  /** 自动播放
17
17
  * @default false
@@ -29,7 +29,7 @@ interface LivePlayerProps extends StandardProps {
29
29
  * @default "vertical"
30
30
  * @supported weapp
31
31
  */
32
- orientation?: keyof LivePlayerProps.orientation
32
+ orientation?: keyof LivePlayerProps.Orientation
33
33
 
34
34
  /** 填充模式
35
35
  * @default "contain"
@@ -44,13 +44,13 @@ interface LivePlayerProps extends StandardProps {
44
44
  */
45
45
  backgroundMute?: boolean
46
46
 
47
- /** 进最小缓冲区,单位s
47
+ /** 最小缓冲区,单位s
48
48
  * @default 1
49
49
  * @supported weapp
50
50
  */
51
51
  minCache?: number
52
52
 
53
- /** 进最小缓冲区,单位s
53
+ /** 最大缓冲区,单位s
54
54
  * @default 3
55
55
  * @supported weapp
56
56
  */
@@ -112,14 +112,14 @@ interface LivePlayerProps extends StandardProps {
112
112
 
113
113
  declare namespace LivePlayerProps {
114
114
  /** mode 的合法值 */
115
- interface mode {
115
+ interface Mode {
116
116
  /** 直播 */
117
117
  live
118
118
  /** 实时通话,该模式时延更低 */
119
119
  RTC
120
120
  }
121
121
  /** orientation 的合法值 */
122
- interface orientation {
122
+ interface Orientation {
123
123
  /** 竖直 */
124
124
  vertical
125
125
  /** 水平 */
@@ -151,10 +151,10 @@ declare namespace LivePlayerProps {
151
151
  fullScreen: number | boolean
152
152
  }
153
153
  interface onNetStatusEventDetail {
154
- info: netStatus
154
+ info: NetStatus
155
155
  }
156
156
  /** 状态码 */
157
- interface status {
157
+ interface Status {
158
158
  /** 已经连接服务器 */
159
159
  2001
160
160
  /** 已经连接 RTMP 服务器,开始拉流 */
@@ -205,11 +205,11 @@ declare namespace LivePlayerProps {
205
205
  }
206
206
 
207
207
  /** 实时音视频播放。相关api:Taro.createLivePlayerContext
208
- *
208
+ *
209
209
  * 需要先通过类目审核,再在小程序管理后台,“设置”-“接口设置”中自助开通该组件权限。
210
210
  * @classification media
211
211
  * @supported weapp
212
- * @example
212
+ * @example_react
213
213
  * ```tsx
214
214
  * class App extends Components {
215
215
  * render () {
@@ -219,6 +219,12 @@ declare namespace LivePlayerProps {
219
219
  * }
220
220
  * }
221
221
  * ```
222
+ * @example_vue
223
+ * ```html
224
+ * <template>
225
+ * <live-player src="url" mode="live" :autoplay="true" />
226
+ * </template>
227
+ * ```
222
228
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html
223
229
  */
224
230
  declare const LivePlayer: ComponentType<LivePlayerProps>
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from 'react'
2
- import { StandardProps, CommonEventFunction, netStatus } from './common'
2
+ import { StandardProps, CommonEventFunction, NetStatus } from './common'
3
3
 
4
4
  /** 实时音视频录制。
5
5
  * 需要用户授权 scope.camera、scope.record
@@ -46,7 +46,7 @@ interface LivePusherProps extends StandardProps {
46
46
  * @default "vertical"
47
47
  * @supported weapp
48
48
  */
49
- orientation?: keyof LivePusherProps.orientation
49
+ orientation?: keyof LivePusherProps.Orientation
50
50
 
51
51
  /** 美颜,取值范围 0-9 ,0 表示关闭
52
52
  * @default 0
@@ -131,13 +131,13 @@ interface LivePusherProps extends StandardProps {
131
131
  * @default "auto"
132
132
  * @supported weapp
133
133
  */
134
- localMirror?: keyof LivePusherProps.localMirror
134
+ localMirror?: keyof LivePusherProps.LocalMirror
135
135
 
136
136
  /** 音频混响类型
137
137
  * @default 0
138
138
  * @supported weapp
139
139
  */
140
- audioReverbType?: keyof LivePusherProps.audioReverbType
140
+ audioReverbType?: keyof LivePusherProps.AudioReverbType
141
141
 
142
142
  /** 开启或关闭麦克风
143
143
  * @default true
@@ -161,7 +161,7 @@ interface LivePusherProps extends StandardProps {
161
161
  * @default "voicecall"
162
162
  * @supported weapp
163
163
  */
164
- audioVolumeType?: keyof LivePusherProps.audioVolumeType
164
+ audioVolumeType?: keyof LivePusherProps.AudioVolumeType
165
165
 
166
166
  /** 上推的视频流的分辨率宽度
167
167
  * @default 360
@@ -179,13 +179,13 @@ interface LivePusherProps extends StandardProps {
179
179
  * @default smooth
180
180
  * @supported weapp
181
181
  */
182
- beautyStyle?: keyof LivePusherProps.beautyStyleType
182
+ beautyStyle?: keyof LivePusherProps.BeautyStyleType
183
183
 
184
184
  /** 设置色彩滤镜
185
185
  * @default standard
186
186
  * @supported weapp
187
187
  */
188
- filter?: keyof LivePusherProps.filterType
188
+ filter?: keyof LivePusherProps.FilterType
189
189
 
190
190
  /** 状态变化事件,detail = {code}
191
191
  * @supported weapp
@@ -225,14 +225,14 @@ interface LivePusherProps extends StandardProps {
225
225
 
226
226
  declare namespace LivePusherProps {
227
227
  /** orientation 的合法值 */
228
- interface orientation {
228
+ interface Orientation {
229
229
  /** 竖直 */
230
230
  vertical
231
231
  /** 水平 */
232
232
  horizontal
233
233
  }
234
234
  /** localMirror 的合法值 */
235
- interface localMirror {
235
+ interface LocalMirror {
236
236
  /** 前置摄像头镜像,后置摄像头不镜像 */
237
237
  auto
238
238
  /** 前后置摄像头均镜像 */
@@ -241,7 +241,7 @@ declare namespace LivePusherProps {
241
241
  disable
242
242
  }
243
243
  /** audioReverbType 的合法值 */
244
- interface audioReverbType {
244
+ interface AudioReverbType {
245
245
  /** 关闭 */
246
246
  0
247
247
  /** KTV */
@@ -260,21 +260,21 @@ declare namespace LivePusherProps {
260
260
  7
261
261
  }
262
262
  /** audioVolumeType 的合法值 */
263
- interface audioVolumeType {
263
+ interface AudioVolumeType {
264
264
  /** 媒体音量 */
265
265
  media
266
266
  /** 通话音量 */
267
267
  voicecall
268
268
  }
269
269
  /** beautyStyleType 的合法值 */
270
- interface beautyStyleType {
270
+ interface BeautyStyleType {
271
271
  /** 光滑美颜 */
272
272
  smooth
273
273
  /** 自然美颜 */
274
274
  nature
275
275
  }
276
276
  /** filterType 的合法值 */
277
- interface filterType {
277
+ interface FilterType {
278
278
  /** 标准 */
279
279
  standard
280
280
  /** 粉嫩 */
@@ -304,7 +304,7 @@ declare namespace LivePusherProps {
304
304
  }
305
305
  interface onNetstatusEventDetail {
306
306
  /** 网络状态 */
307
- info: netStatus
307
+ info: NetStatus
308
308
  }
309
309
  interface onErrorEventDetail {
310
310
  /** 错误信息 */
@@ -324,7 +324,7 @@ declare namespace LivePusherProps {
324
324
  * 需要先通过类目审核,再在小程序管理后台,「开发」-「接口设置」中自助开通该组件权限。
325
325
  * @classification media
326
326
  * @supported weapp
327
- * @example
327
+ * @example_react
328
328
  * ```tsx
329
329
  * class App extends Components {
330
330
  * render () {
@@ -334,6 +334,12 @@ declare namespace LivePusherProps {
334
334
  * }
335
335
  * }
336
336
  * ```
337
+ * @example_vue
338
+ * ```html
339
+ * <template>
340
+ * <live-pusher url="url" mode="RTC" :autopush="true" />
341
+ * </template>
342
+ * ```
337
343
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html
338
344
  */
339
345
  declare const LivePusher: ComponentType<LivePusherProps>