@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/Radio.d.ts CHANGED
@@ -24,12 +24,17 @@ interface RadioProps extends StandardProps {
24
24
  * @supported weapp, rn
25
25
  */
26
26
  color?: string
27
+
28
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
29
+ * @supported h5
30
+ */
31
+ nativeProps?: Record<string, unknown>
27
32
  }
28
33
 
29
34
  /** 单选项目
30
35
  * @classification forms
31
36
  * @supported weapp, h5, rn
32
- * @example
37
+ * @example_react
33
38
  * ```tsx
34
39
  * export default class PageRadio extends Component {
35
40
  * state = {
@@ -96,6 +101,77 @@ interface RadioProps extends StandardProps {
96
101
  * }
97
102
  * }
98
103
  * ```
104
+ * @example_vue
105
+ * ```html
106
+ * <template>
107
+ * <view class="container">
108
+ * <view class="page-section">
109
+ * <text>默认样式</text>
110
+ * <radio value="选中" :checked="true">选中</radio>
111
+ * <radio style="margin-left: 20rpx;" value="未选中">未选中</radio>
112
+ * </view>
113
+ * <view class="page-section">
114
+ * <text>推荐展示样式(Taro 团队成员):</text>
115
+ * <radio-group `@change="onChange">
116
+ * <label v-for="item in list" class="checkbox-list__label">
117
+ * <radio class="checkbox-list__checkbox" :value="item.value" :checked="item.checked">{{ item.text }}</radio>
118
+ * </label>
119
+ * </radio-group>
120
+ * </view>
121
+ * </view>
122
+ * </template>
123
+ *
124
+ * <script>
125
+ * export default {
126
+ * data() {
127
+ * return {
128
+ * list: [
129
+ * {
130
+ * value: 'yuche',
131
+ * text: 'yuche',
132
+ * checked: false
133
+ * },
134
+ * {
135
+ * value: 'cjj',
136
+ * text: 'cjj',
137
+ * checked: false
138
+ * },
139
+ * {
140
+ * value: 'xiexiaoli',
141
+ * text: 'xiexiaoli',
142
+ * checked: false
143
+ * },
144
+ * {
145
+ * value: 'honly',
146
+ * text: 'honly',
147
+ * checked: false
148
+ * },
149
+ * {
150
+ * value: 'cs',
151
+ * text: 'cs',
152
+ * checked: false
153
+ * },
154
+ * {
155
+ * value: 'zhutianjian',
156
+ * text: 'zhutianjian',
157
+ * checked: false
158
+ * },
159
+ * {
160
+ * value: '隔壁老李',
161
+ * text: '隔壁老李',
162
+ * checked: true
163
+ * }
164
+ * ]
165
+ * }
166
+ * },
167
+ * methods: {
168
+ * onChange: function(e) {
169
+ * console.log(e.detail.value)
170
+ * }
171
+ * }
172
+ * }
173
+ * </script>
174
+ * ```
99
175
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/radio.html
100
176
  */
101
177
  declare const Radio: ComponentType<RadioProps>
@@ -65,7 +65,7 @@ declare namespace RichTextProps {
65
65
  /** 富文本
66
66
  * @classification base
67
67
  * @supported weapp, swan, alipay, tt, h5, rn
68
- * @example
68
+ * @example_react
69
69
  * ```tsx
70
70
  * class App extends Components {
71
71
  * state = {
@@ -88,6 +88,38 @@ declare namespace RichTextProps {
88
88
  * }
89
89
  * }
90
90
  * ```
91
+ * @example_vue
92
+ * ```html
93
+ * <template>
94
+ * <view class="components-page">
95
+ * <rich-text :nodes="nodes"></rich-text>
96
+ * </view>
97
+ * </template>
98
+ *
99
+ * <script>
100
+ * export default {
101
+ * name: 'Index',
102
+ * data() {
103
+ * return {
104
+ * nodes: [{
105
+ * name: 'div',
106
+ * attrs: {
107
+ * class: 'div_class',
108
+ * style: 'line-height: 60px; color: red;'
109
+ * },
110
+ * children: [{
111
+ * type: 'text',
112
+ * text: 'Hello World!'
113
+ * }]
114
+ * }]
115
+ * }
116
+ * },
117
+ * onReady () {
118
+ * console.log('onReady')
119
+ * }
120
+ * }
121
+ * </script>
122
+ * ```
91
123
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html
92
124
  */
93
125
  declare const RichText: ComponentType<RichTextProps>
@@ -98,31 +98,31 @@ interface ScrollViewProps extends StandardProps {
98
98
  refresherTriggered?: boolean
99
99
 
100
100
  /** 启用 scroll-view 增强特性
101
- * @supported weapp 2.12.0+
101
+ * @supported weapp
102
102
  * @default false
103
103
  */
104
104
  enhanced?: boolean
105
105
 
106
106
  /** iOS 下 scroll-view 边界弹性控制 (同时开启 enhanced 属性后生效)
107
- * @supported weapp 2.12.0+
107
+ * @supported weapp
108
108
  * @default true
109
109
  */
110
110
  bounces?: boolean
111
111
 
112
112
  /** 滚动条显隐控制 (同时开启 enhanced 属性后生效)
113
- * @supported weapp 2.12.0+
113
+ * @supported weapp
114
114
  * @default true
115
115
  */
116
116
  showScrollbar?: boolean
117
117
 
118
118
  /** 分页滑动效果 (同时开启 enhanced 属性后生效)
119
- * @supported weapp 2.12.0+
119
+ * @supported weapp
120
120
  * @default false
121
121
  */
122
122
  pagingEnabled?: boolean
123
123
 
124
124
  /** boolean false 滑动减速速率控制 (同时开启 enhanced 属性后生效)
125
- * @supported weapp 2.12.0+
125
+ * @supported weapp
126
126
  * @default false
127
127
  */
128
128
  fastDeceleration?: boolean
@@ -164,17 +164,17 @@ interface ScrollViewProps extends StandardProps {
164
164
  onRefresherAbort?: CommonEventFunction
165
165
 
166
166
  /** 滑动开始事件 (同时开启 enhanced 属性后生效)
167
- * @supported weapp 2.12.0+
167
+ * @supported weapp
168
168
  */
169
169
  onDragStart?: CommonEventFunction
170
170
 
171
171
  /** 滑动事件 (同时开启 enhanced 属性后生效)
172
- * @supported weapp 2.12.0+
172
+ * @supported weapp
173
173
  */
174
174
  onDragging?: CommonEventFunction
175
175
 
176
176
  /** 滑动结束事件 (同时开启 enhanced 属性后生效)
177
- * @supported weapp 2.12.0+
177
+ * @supported weapp
178
178
  */
179
179
  onDragEnd?: CommonEventFunction
180
180
  }
@@ -200,7 +200,8 @@ declare namespace ScrollViewProps {
200
200
  * H5 中 ScrollView 组件是通过一个高度(或宽度)固定的容器内部滚动来实现的,因此务必正确的设置容器的高度。例如: 如果 ScrollView 的高度将 body 撑开,就会同时存在两个滚动条(body 下的滚动条,以及 ScrollView 的滚动条)。
201
201
  * 微信小程序 中 ScrollView 组件如果设置 scrollX 横向滚动时,并且子元素为多个时(单个子元素时设置固定宽度则可以正常横向滚动),需要通过 WXSS 设置 `white-space: nowrap` 来保证元素不换行,并对 ScrollView 内部元素设置 `display: inline-block` 来使其能够横向滚动。
202
202
  * @classification viewContainer
203
- * @example
203
+ * @supported weapp, swan, alipay, tt, h5, rn
204
+ * @example_react
204
205
  * ```tsx
205
206
  * export default class PageView extends Component {
206
207
  * constructor() {
@@ -255,6 +256,87 @@ declare namespace ScrollViewProps {
255
256
  * }
256
257
  * }
257
258
  * ```
259
+ * @example_vue
260
+ * ```html
261
+ * <template>
262
+ * <view class="container">
263
+ * <view class="page-body">
264
+ * <view class="page-section">
265
+ * <view class="page-section-title">
266
+ * <text>Vertical Scroll - 纵向滚动</text>
267
+ * </view>
268
+ * <view class="page-section-spacing">
269
+ * <scroll-view :scroll-y="true" style="height: 300rpx;" `@scrolltoupper="upper" `@scrolltolower="lower" `@scroll="scroll" :scroll-into-view="toView" :scroll-top="scrollTop">
270
+ * <view id="demo1" class="scroll-view-item demo-text-1">1</view>
271
+ * <view id="demo2" class="scroll-view-item demo-text-2">2</view>
272
+ * <view id="demo3" class="scroll-view-item demo-text-3">3</view>
273
+ * </scroll-view>
274
+ * </view>
275
+ * </view>
276
+ * <view class="page-section">
277
+ * <view class="page-section-title">
278
+ * <text>Horizontal Scroll - 横向滚动</text>
279
+ * </view>
280
+ * <view class="page-section-spacing">
281
+ * <scroll-view class="scroll-view_H" :scroll-x="true" `@scroll="scroll" style="width: 100%">
282
+ * <view id="demo21" class="scroll-view-item_H demo-text-1">a</view>
283
+ * <view id="demo22" class="scroll-view-item_H demo-text-2">b</view>
284
+ * <view id="demo23" class="scroll-view-item_H demo-text-3">c</view>
285
+ * </scroll-view>
286
+ * </view>
287
+ * </view>
288
+ * </view>
289
+ * </view>
290
+ * </template>
291
+ *
292
+ * <script>
293
+ * const order = ['demo1', 'demo2', 'demo3']
294
+ * export default {
295
+ * name: 'Index',
296
+ * data() {
297
+ * return {
298
+ * scrollTop: 0,
299
+ * toView: 'demo2'
300
+ * }
301
+ * },
302
+ *
303
+ * methods: {
304
+ * upper(e) {
305
+ * console.log('upper:', e)
306
+ * },
307
+ *
308
+ * lower(e) {
309
+ * console.log('lower:', e)
310
+ * },
311
+ *
312
+ * scroll(e) {
313
+ * console.log('scroll:', e)
314
+ * }
315
+ * }
316
+ * }
317
+ * </script>
318
+ *
319
+ * <style>
320
+ * .page-section-spacing{
321
+ * margin-top: 60rpx;
322
+ * }
323
+ * .scroll-view_H{
324
+ * white-space: nowrap;
325
+ * }
326
+ * .scroll-view-item{
327
+ * height: 300rpx;
328
+ * }
329
+ * .scroll-view-item_H{
330
+ * display: inline-block;
331
+ * width: 100%;
332
+ * height: 300rpx;
333
+ * }
334
+ *
335
+ * .demo-text-1 { background: #ccc; }
336
+ * .demo-text-2 { background: #999; }
337
+ * .demo-text-3 { background: #666; }
338
+ * </style>
339
+ * ```
258
340
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html
259
341
  */
260
342
  declare const ScrollView: ComponentType<ScrollViewProps>
@@ -28,7 +28,7 @@ interface ShareElementProps extends StandardProps {
28
28
 
29
29
  /** 共享元素
30
30
  *
31
- * 共享元素是一种动画形式,类似于 [`flutter Hero`](https://flutterchina.club/animations/hero-animations/) 动画,表现为元素像是在页面间穿越一样。该组件需与 [`page-container`](https://developers.weixin.qq.com/miniprogram/dev/component/page-container.html) 组件结合使用。
31
+ * 共享元素是一种动画形式,类似于 [`flutter Hero`](https://flutterchina.club/animations/hero-animations/) 动画,表现为元素像是在页面间穿越一样。该组件需与 [`page-container`](/docs/components/viewContainer/page-container) 组件结合使用。
32
32
  * 使用时需在当前页放置 `share-element` 组件,同时在 `page-container` 容器中放置对应的 `share-element` 组件,对应关系通过属性值 key 映射。当设置 `page-container` `显示时,transform` 属性为 `true` 的共享元素会产生动画。当前页面容器退出时,会产生返回动画。
33
33
  * @classification viewContainer
34
34
  * @supported weapp
package/types/Slider.d.ts CHANGED
@@ -94,7 +94,7 @@ declare namespace SliderProps {
94
94
  /** 滑动选择器
95
95
  * @classification forms
96
96
  * @supported weapp, h5, rn, swan, alipay, tt
97
- * @example
97
+ * @example_react
98
98
  * ```tsx
99
99
  * export default class PageView extends Component {
100
100
  * constructor() {
@@ -115,6 +115,19 @@ declare namespace SliderProps {
115
115
  * }
116
116
  * }
117
117
  * ```
118
+ * @example_vue
119
+ * ```html
120
+ * <template>
121
+ * <view class="components-page">
122
+ * <text>设置 step</text>
123
+ * <slider step="1" value="50"/>
124
+ * <text>显示当前 value</text>
125
+ * <slider step="1" value="50" :show-value="true" />
126
+ * <text>设置最小/最大值</text>
127
+ * <slider step="1" value="100" :show-value="true" min="50" max="200"/>
128
+ * </view>
129
+ * </template>
130
+ * ```
118
131
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/slider.html
119
132
  */
120
133
  declare const Slider: ComponentType<SliderProps>
package/types/Swiper.d.ts CHANGED
@@ -163,9 +163,10 @@ declare namespace SwiperProps {
163
163
  }
164
164
 
165
165
  /** 滑块视图容器。其中只可放置 swiper-item 组件,否则会导致未定义的行为。
166
+ * > 不要为 `SwiperItem` 设置 **style** 属性,可以通过 class 设置样式。[7147](https://github.com/NervJS/taro/issues/7147)
166
167
  * @classification viewContainer
167
168
  * @supported weapp, swan, alipay, tt, h5, rn
168
- * @example
169
+ * @example_react
169
170
  * ```tsx
170
171
  * class App extends Component {
171
172
  * render () {
@@ -192,6 +193,30 @@ declare namespace SwiperProps {
192
193
  * }
193
194
  * }
194
195
  * ```
196
+ * @example_vue
197
+ * ```html
198
+ * <template>
199
+ * <swiper
200
+ * class='test-h'
201
+ * indicator-color='#999'
202
+ * indicator-active-color='#333'
203
+ * :vertical="true"
204
+ * :circular="true"
205
+ * :indicator-dots="true"
206
+ * :autoplay="true"
207
+ * >
208
+ * <swiper-item>
209
+ * <view class='demo-text-1'>1</view>
210
+ * </swiper-item>
211
+ * <swiper-item>
212
+ * <view class='demo-text-2'>2</view>
213
+ * </swiper-item>
214
+ * <swiper-item>
215
+ * <view class='demo-text-3'>3</view>
216
+ * </swiper-item>
217
+ * </swiper>
218
+ * </template>
219
+ * ```
195
220
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/swiper.html
196
221
  */
197
222
  declare const Swiper: ComponentType<SwiperProps>
@@ -3,15 +3,16 @@ import { StandardProps } from './common'
3
3
 
4
4
  interface SwiperItemProps extends StandardProps {
5
5
  /** 该 swiper-item 的标识符
6
- * @supported weapp
6
+ * @supported weapp, swan, alipay, tt, h5, rn
7
7
  */
8
8
  itemId?: string
9
9
  }
10
10
 
11
11
  /** 仅可放置在 swiper 组件中,宽高自动设置为100%
12
+ * > 不要为 `SwiperItem` 设置 **style** 属性,可以通过 class 设置样式。[7147](https://github.com/NervJS/taro/issues/7147)
12
13
  * @classification viewContainer
13
- * @supported weapp
14
- * @example
14
+ * @supported weapp, swan, alipay, tt, h5, rn
15
+ * @example_react
15
16
  * ```tsx
16
17
  * class App extends Component {
17
18
  * render () {
@@ -38,6 +39,30 @@ interface SwiperItemProps extends StandardProps {
38
39
  * }
39
40
  * }
40
41
  * ```
42
+ * @example_vue
43
+ * ```html
44
+ * <template>
45
+ * <swiper
46
+ * class='test-h'
47
+ * indicator-color='#999'
48
+ * indicator-active-color='#333'
49
+ * :vertical="true"
50
+ * :circular="true"
51
+ * :indicator-dots="true"
52
+ * :autoplay="true"
53
+ * >
54
+ * <swiper-item>
55
+ * <view class='demo-text-1'>1</view>
56
+ * </swiper-item>
57
+ * <swiper-item>
58
+ * <view class='demo-text-2'>2</view>
59
+ * </swiper-item>
60
+ * <swiper-item>
61
+ * <view class='demo-text-3'>3</view>
62
+ * </swiper-item>
63
+ * </swiper>
64
+ * </template>
65
+ * ```
41
66
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/swiper-item.html
42
67
  */
43
68
  declare const SwiperItem: ComponentType<SwiperItemProps>
package/types/Switch.d.ts CHANGED
@@ -10,7 +10,7 @@ interface SwitchProps extends StandardProps, FormItemProps {
10
10
 
11
11
  /** 是否禁用
12
12
  * @default false
13
- * @supported weapp
13
+ * @supported weapp, rn
14
14
  */
15
15
  disabled?: boolean
16
16
 
@@ -27,9 +27,14 @@ interface SwitchProps extends StandardProps, FormItemProps {
27
27
  color?: string
28
28
 
29
29
  /** checked 改变时触发 change 事件
30
- * @supported weapp
30
+ * @supported weapp, rn
31
31
  */
32
32
  onChange?: CommonEventFunction<SwitchProps.onChangeEventDetail>
33
+
34
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
35
+ * @supported h5
36
+ */
37
+ nativeProps?: Record<string, unknown>
33
38
  }
34
39
 
35
40
  declare namespace SwitchProps {
@@ -40,7 +45,7 @@ declare namespace SwitchProps {
40
45
 
41
46
  /** 开关选择器
42
47
  * @classification forms
43
- * @example
48
+ * @example_react
44
49
  * ```tsx
45
50
  * export default class PageView extends Component {
46
51
  * constructor() {
@@ -61,6 +66,19 @@ declare namespace SwitchProps {
61
66
  * }
62
67
  * }
63
68
  * ```
69
+ * @example_vue
70
+ * ```html
71
+ * <template>
72
+ * <view class='components-page'>
73
+ * <text>默认样式</text>
74
+ * <switch :checked="true" />
75
+ * <switch />
76
+ * <text>推荐展示样式</text>
77
+ * <switch :checked="true" />
78
+ * <switch />
79
+ * </view>
80
+ * </template>
81
+ * ```
64
82
  * @supported weapp, h5, rn, swan, alipay, tt
65
83
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/switch.html
66
84
  */
package/types/Text.d.ts CHANGED
@@ -41,7 +41,7 @@ declare namespace TextProps {
41
41
  /** 文本
42
42
  * @classification base
43
43
  * @supported weapp, swan, alipay, tt, h5, rn
44
- * @example
44
+ * @example_react
45
45
  * ```tsx
46
46
  * export default class PageView extends Component {
47
47
  * state = {
@@ -84,6 +84,43 @@ declare namespace TextProps {
84
84
  * }
85
85
  * }
86
86
  * ```
87
+ * @example_vue
88
+ * ``` html
89
+ * <template>
90
+ * <view class="container">
91
+ * <view v-for="(item, index) in contents">
92
+ * <text>{{item.text}} line {{index + 1}}</text>
93
+ * </view>
94
+ * <button class="btn-max-w button_style" :plain="true" type="default" `@tap="add">add line</button>
95
+ * <button class="btn-max-w button_style" :plain="true" type="default" :disabled="contentsLen ? false : true" `@tap="remove">remove line</button>
96
+ * </template>
97
+ *
98
+ * <script>
99
+ * export default {
100
+ * data() {
101
+ * return {
102
+ * contents: [],
103
+ * contentsLen: 0
104
+ * }
105
+ * },
106
+ * methods: {
107
+ * add () {
108
+ * const cot = this.contents.slice()
109
+ * cot.push({ text: 'hello world' })
110
+ * this.contents = cot
111
+ * this.contentsLen = cot.length
112
+ * },
113
+ *
114
+ * remove () {
115
+ * const cot = this.contents.slice()
116
+ * cot.pop()
117
+ * this.contents = cot
118
+ * this.contentsLen = cot.length
119
+ * }
120
+ * }
121
+ * }
122
+ * </script>
123
+ * ```
87
124
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/text.html
88
125
  */
89
126
  declare const Text: ComponentType<TextProps>
@@ -138,6 +138,11 @@ interface TextareaProps extends StandardProps, FormItemProps {
138
138
  * @supported weapp
139
139
  */
140
140
  onKeyboardHeightChange?: CommonEventFunction<TextareaProps.onKeyboardHeightChangeEventDetail>
141
+
142
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
143
+ * @supported h5
144
+ */
145
+ nativeProps?: Record<string, unknown>
141
146
  }
142
147
 
143
148
  declare namespace TextareaProps {
@@ -181,7 +186,7 @@ declare namespace TextareaProps {
181
186
  /** 多行输入框。该组件是原生组件,使用时请注意相关限制
182
187
  * @classification forms
183
188
  * @supported weapp, h5, rn
184
- * @example
189
+ * @example_react
185
190
  * ```tsx
186
191
  * export default class PageView extends Component {
187
192
  * constructor() {
@@ -200,6 +205,17 @@ declare namespace TextareaProps {
200
205
  * }
201
206
  * }
202
207
  * ```
208
+ * @example_vue
209
+ * ```html
210
+ * <template>
211
+ * <view class="components-page">
212
+ * <text>输入区域高度自适应,不会出现滚动条</text>
213
+ * <textarea style="background:#efefef;width:100%;min-height:80px;padding:0 30rpx;" :auto-height="true" />
214
+ * <text>这是一个可以自动聚焦的 textarea</text>
215
+ * <textarea style="background:#efefef;width:100%;height:80px;padding:0 30rpx;" :auto-focusd="true" />
216
+ * </view>
217
+ * </template>
218
+ * ```
203
219
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/textarea.html
204
220
  */
205
221
  declare const Textarea: ComponentType<TextareaProps>