From da77283af72dab1795094121b74fdf07909cad08 Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Wed, 20 Nov 2024 17:43:58 +0800 Subject: [PATCH 1/7] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0ts=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-components/types/Button.d.ts | 10 +- packages/taro-components/types/Camera.d.ts | 2 +- packages/taro-components/types/Checkbox.d.ts | 10 +- .../taro-components/types/CoverImage.d.ts | 2 +- .../taro-components/types/DraggableSheet.d.ts | 5 + packages/taro-components/types/Editor.d.ts | 22 +- packages/taro-components/types/Form.d.ts | 4 +- packages/taro-components/types/Icon.d.ts | 6 +- packages/taro-components/types/Image.d.ts | 5 +- packages/taro-components/types/Input.d.ts | 54 +++- packages/taro-components/types/Label.d.ts | 2 +- packages/taro-components/types/ListView.d.ts | 2 +- .../taro-components/types/MatchMedia.d.ts | 16 +- .../taro-components/types/NavigationBar.d.ts | 8 +- packages/taro-components/types/Navigator.d.ts | 2 +- .../taro-components/types/PageContainer.d.ts | 32 +- packages/taro-components/types/PageMeta.d.ts | 14 +- packages/taro-components/types/Picker.d.ts | 49 +-- .../taro-components/types/PickerView.d.ts | 2 +- .../types/PickerViewColumn.d.ts | 2 +- packages/taro-components/types/Progress.d.ts | 2 +- packages/taro-components/types/Radio.d.ts | 10 +- .../taro-components/types/RadioGroup.d.ts | 2 +- packages/taro-components/types/RichText.d.ts | 13 +- .../taro-components/types/ScrollView.d.ts | 34 +- .../taro-components/types/ShareElement.d.ts | 4 +- packages/taro-components/types/Slider.d.ts | 28 +- packages/taro-components/types/Slot.d.ts | 2 +- .../taro-components/types/StickyHeader.d.ts | 8 +- .../taro-components/types/StickySection.d.ts | 2 +- packages/taro-components/types/Swiper.d.ts | 104 ++++-- .../taro-components/types/SwiperItem.d.ts | 2 +- packages/taro-components/types/Switch.d.ts | 10 +- packages/taro-components/types/Text.d.ts | 6 +- packages/taro-components/types/Textarea.d.ts | 35 ++- packages/taro-components/types/Video.d.ts | 32 +- packages/taro-components/types/common.d.ts | 12 +- .../gesture/DoubleTapGestureHandler.d.ts | 53 ++++ .../gesture/ForcePressGestureHandler.d.ts | 49 +++ .../gesture/HorizontalDragGestureHandler.d.ts | 53 ++++ .../gesture/LongPressGestureHandler.d.ts | 53 ++++ .../types/gesture/PanGestureHandler.d.ts | 53 ++++ .../types/gesture/ScaleGestureHandler.d.ts | 53 ++++ .../types/gesture/TapGestureHandler.d.ts | 53 ++++ .../gesture/VerticalDragGestureHandler.d.ts | 53 ++++ .../taro-components/types/gesture/common.d.ts | 26 ++ packages/taro-components/types/global.d.ts | 4 + packages/taro-components/types/index.d.ts | 28 ++ .../taro-components/types/index.solid.d.ts | 297 ++++++++++++++++++ packages/taro/types/api/base/env.d.ts | 2 +- packages/taro/types/api/base/system.d.ts | 4 +- .../taro/types/api/base/weapp/app-event.d.ts | 8 +- .../taro/types/api/device/accelerometer.d.ts | 8 +- packages/taro/types/api/device/battery.d.ts | 4 +- packages/taro/types/api/device/clipboard.d.ts | 28 +- packages/taro/types/api/device/keyboard.d.ts | 4 +- packages/taro/types/api/device/network.d.ts | 6 +- packages/taro/types/api/device/phone.d.ts | 2 +- packages/taro/types/api/device/screen.d.ts | 4 +- packages/taro/types/api/device/vibrate.d.ts | 4 +- packages/taro/types/api/media/image.d.ts | 6 +- packages/taro/types/api/network/request.d.ts | 4 +- packages/taro/types/api/route/index.d.ts | 118 ++++++- packages/taro/types/api/skyline/index.d.ts | 286 +++++++++++++++++ packages/taro/types/api/storage/index.d.ts | 8 +- packages/taro/types/api/swan/pay.d.ts | 8 +- packages/taro/types/api/taro.extend.d.ts | 8 +- packages/taro/types/api/ui/animation.d.ts | 2 +- packages/taro/types/api/ui/interaction.d.ts | 6 +- .../taro/types/api/ui/navigation-bar.d.ts | 10 +- .../taro/types/api/ui/pull-down-refresh.d.ts | 4 +- packages/taro/types/api/ui/scroll.d.ts | 2 +- packages/taro/types/api/ui/tab-bar.d.ts | 14 +- packages/taro/types/api/wxml/index.d.ts | 24 +- packages/taro/types/compile/compiler.d.ts | 13 +- packages/taro/types/compile/config/h5.d.ts | 35 ++- .../taro/types/compile/config/harmony.d.ts | 118 +++++++ packages/taro/types/compile/config/index.d.ts | 2 + packages/taro/types/compile/config/mini.d.ts | 55 ++-- .../taro/types/compile/config/plugin.d.ts | 34 ++ .../taro/types/compile/config/project.d.ts | 70 +++-- packages/taro/types/compile/config/rn.d.ts | 21 ++ packages/taro/types/compile/config/util.d.ts | 28 +- packages/taro/types/compile/index.d.ts | 8 + .../types/compile/viteCompilerContext.d.ts | 159 ++++++++++ packages/taro/types/index.d.ts | 1 - packages/taro/types/taro.component.d.ts | 21 ++ packages/taro/types/taro.config.d.ts | 5 + 88 files changed, 2121 insertions(+), 353 deletions(-) create mode 100644 packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/LongPressGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/PanGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/ScaleGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/TapGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/common.d.ts create mode 100644 packages/taro-components/types/global.d.ts create mode 100644 packages/taro-components/types/index.solid.d.ts create mode 100644 packages/taro/types/compile/config/harmony.d.ts create mode 100644 packages/taro/types/compile/config/plugin.d.ts create mode 100644 packages/taro/types/compile/viteCompilerContext.d.ts diff --git a/packages/taro-components/types/Button.d.ts b/packages/taro-components/types/Button.d.ts index 022bd9127252..eda7e182ac28 100644 --- a/packages/taro-components/types/Button.d.ts +++ b/packages/taro-components/types/Button.d.ts @@ -8,27 +8,27 @@ interface ButtonProps extends StandardProps { */ size?: keyof ButtonProps.Size /** 按钮的样式类型 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @default default */ type?: keyof ButtonProps.Type /** 按钮是否镂空,背景色透明 - * @supported weapp, alipay, swan, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, qq, jd, h5, rn, harmony, harmony_hybrid * @default false */ plain?: boolean /** 是否禁用 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @default false */ disabled?: boolean /** 名称前是否带 loading 图标 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @default false */ loading?: boolean /** 用于 `
` 组件,点击分别会触发 `` 组件的 submit/reset 事件 - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, harmony */ formType?: keyof ButtonProps.FormType /** 微信开放能力 diff --git a/packages/taro-components/types/Camera.d.ts b/packages/taro-components/types/Camera.d.ts index 0b0207e271e3..8c82f7ba4080 100644 --- a/packages/taro-components/types/Camera.d.ts +++ b/packages/taro-components/types/Camera.d.ts @@ -121,7 +121,7 @@ declare namespace CameraProps { } /** 系统相机 * @classification media - * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony + * @supported weapp, alipay, swan, tt, qq, jd, rn * @see https://developers.weixin.qq.com/miniprogram/dev/component/camera.html */ declare const Camera: ComponentType diff --git a/packages/taro-components/types/Checkbox.d.ts b/packages/taro-components/types/Checkbox.d.ts index 172e3cef0943..ea468c9e5a67 100644 --- a/packages/taro-components/types/Checkbox.d.ts +++ b/packages/taro-components/types/Checkbox.d.ts @@ -2,21 +2,21 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface CheckboxProps extends StandardProps { /** ``标识,选中时触发``的 change 事件,并携带 `` 的 value - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ value: string /** 是否禁用 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @default false */ disabled?: boolean /** 当前是否选中,可用来设置默认选中 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @default false */ checked?: boolean /** checkbox的颜色,同 css 的 color - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ color?: string /** @@ -33,7 +33,7 @@ interface CheckboxProps extends StandardProps { */ ariaLabel?: string /** 选中项发生变化时触发 change 事件,小程序无此 API - * @supported alipay, h5, rn, harmony_hybrid + * @supported alipay, h5, rn, harmony, harmony_hybrid */ onChange?: CommonEventFunction<{ value: string[] diff --git a/packages/taro-components/types/CoverImage.d.ts b/packages/taro-components/types/CoverImage.d.ts index f4e6b43d15b9..e1cc2a628991 100644 --- a/packages/taro-components/types/CoverImage.d.ts +++ b/packages/taro-components/types/CoverImage.d.ts @@ -48,7 +48,7 @@ interface CoverImageProps extends StandardProps { } /** 覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。 * @classification viewContainer - * @supported weapp, alipay, swan, qq, jd, h5, harmony, harmony_hybrid + * @supported weapp, alipay, swan, qq, jd, h5, harmony_hybrid * @example_react * ```tsx * // js diff --git a/packages/taro-components/types/DraggableSheet.d.ts b/packages/taro-components/types/DraggableSheet.d.ts index be16f7c4d42c..04c3643febbc 100644 --- a/packages/taro-components/types/DraggableSheet.d.ts +++ b/packages/taro-components/types/DraggableSheet.d.ts @@ -32,6 +32,11 @@ interface DraggableSheetProps extends StandardProps { * @default [] */ snapSizes?: any[] + /** + * 尺寸发生变化时触发,仅支持 worklet 作为回调。event = {pixels, size} + * @supported weapp + */ + onSizeUpdateWorklet?: string } /** diff --git a/packages/taro-components/types/Editor.d.ts b/packages/taro-components/types/Editor.d.ts index 13718a1402c6..7bc3c50a0260 100644 --- a/packages/taro-components/types/Editor.d.ts +++ b/packages/taro-components/types/Editor.d.ts @@ -3,48 +3,48 @@ import { StandardProps, CommonEventFunction } from './common' interface EditorProps extends StandardProps { /** 设置编辑器为只读 * @default false - * @supported weapp + * @supported weapp, jd */ readOnly?: boolean /** 提示信息 - * @supported weapp + * @supported weapp, jd */ placeholder?: string /** 点击图片时显示图片大小控件 * @default false - * @supported weapp + * @supported weapp, jd */ showImgSize?: boolean /** 点击图片时显示工具栏控件 * @default false - * @supported weapp + * @supported weapp, jd */ showImgToolbar?: boolean /** 点击图片时显示修改尺寸控件 * @default false - * @supported weapp + * @supported weapp, jd */ showImgResize?: boolean /** 编辑器初始化完成时触发 - * @supported weapp + * @supported weapp, jd */ onReady?: CommonEventFunction /** 编辑器聚焦时触发 - * @supported weapp + * @supported weapp, jd */ onFocus?: CommonEventFunction /** 编辑器失去焦点时触发 * detail = { html, text, delta } - * @supported weapp + * @supported weapp, jd */ onBlur?: CommonEventFunction /** 编辑器内容改变时触发 * detail = { html, text, delta } - * @supported weapp + * @supported weapp, jd */ onInput?: CommonEventFunction /** 通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式 - * @supported weapp + * @supported weapp, jd */ onStatusChange?: CommonEventFunction } @@ -67,7 +67,7 @@ declare namespace EditorProps { * * *编辑器内支持部分 HTML 标签和内联样式,不支持 **class** 和 **id*** * @classification forms - * @supported weapp + * @supported weapp, jd * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-components/types/Form.d.ts b/packages/taro-components/types/Form.d.ts index 7b612900944b..2539ee20a554 100644 --- a/packages/taro-components/types/Form.d.ts +++ b/packages/taro-components/types/Form.d.ts @@ -43,11 +43,11 @@ interface FormProps extends StandardProps { */ clueComponentId?: string /** 携带 form 中的数据触发 submit 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onSubmit?: CommonEventFunction /** 表单重置时会触发 reset 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onReset?: CommonEventFunction } diff --git a/packages/taro-components/types/Icon.d.ts b/packages/taro-components/types/Icon.d.ts index 54cbed3cc001..7ff5d5d19317 100644 --- a/packages/taro-components/types/Icon.d.ts +++ b/packages/taro-components/types/Icon.d.ts @@ -2,16 +2,16 @@ import { ComponentType } from 'react' import { StandardProps } from './common' interface IconProps extends StandardProps { /** icon 的类型 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ type: keyof IconProps.TIconType /** icon 的大小,单位px * @default 23 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid */ - size?: string + size?: number /** icon 的颜色,同 css 的 color - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ color?: string /** 无障碍访问,(属性)元素的额外描述 diff --git a/packages/taro-components/types/Image.d.ts b/packages/taro-components/types/Image.d.ts index 971cfbf07071..f0cc0fafe5c2 100644 --- a/packages/taro-components/types/Image.d.ts +++ b/packages/taro-components/types/Image.d.ts @@ -2,13 +2,14 @@ import { ComponentType, ImgHTMLAttributes } from 'react' import { StandardProps, CommonEventFunction } from './common' interface ImageProps extends StandardProps { /** 图片资源地址 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ src: string /** 图片裁剪、缩放的模式 * @default "scaleToFill" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @rn 部分支持 scaleToFill, aspectFit, aspectFill, widthFix + * @harmony 部分支持 scaleToFill, aspectFit, aspectFill, widthFix, heightFix */ mode?: keyof ImageProps.Mode /** 默认不解析 webP 格式,只支持网络资源 diff --git a/packages/taro-components/types/Input.d.ts b/packages/taro-components/types/Input.d.ts index 375c9a59d50a..a61e5943546c 100644 --- a/packages/taro-components/types/Input.d.ts +++ b/packages/taro-components/types/Input.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface InputProps extends StandardProps, FormItemProps { /** 输入框的初始内容 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ value?: string /** 设置 React 非受控输入框的初始内容 @@ -12,20 +12,20 @@ interface InputProps extends StandardProps, FormItemProps { defaultValue?: string /** input 的类型 * @default "text" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ type?: keyof InputProps.Type /** 是否是密码类型 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ password?: boolean /** 输入框为空时占位符 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ placeholder?: string /** 指定 placeholder 的样式 - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony */ placeholderStyle?: string /** 指定 placeholder 的样式类 @@ -34,7 +34,7 @@ interface InputProps extends StandardProps, FormItemProps { */ placeholderClass?: string /** 指定 placeholder 的文本颜色 - * @supported rn + * @supported rn, harmony */ placeholderTextColor?: string /** 是否禁用 @@ -44,7 +44,7 @@ interface InputProps extends StandardProps, FormItemProps { disabled?: boolean /** 最大输入长度,设置为 -1 的时候不限制最大长度 * @default 140 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ maxlength?: number /** 指定光标与键盘的距离,单位 px 。取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 @@ -66,7 +66,7 @@ interface InputProps extends StandardProps, FormItemProps { /** 设置键盘右下角按钮的文字,仅在type='text'时生效 * @alipay confirm-type 与 enableNative 属性冲突,若希望 confirm-type 生效,enableNative 不能设定为 false,而且不能设定 always-system * @default done - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony */ confirmType?: keyof InputProps.ConfirmType /** 点击键盘右下角按钮时是否保持键盘不收起 @@ -75,9 +75,13 @@ interface InputProps extends StandardProps, FormItemProps { */ confirmHold?: boolean /** 指定focus时的光标位置 - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony */ cursor?: number + /** 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 + * @supported weapp + */ + cursorColor?: string /** 光标起始位置,自动聚集时有效,需与selection-end搭配使用 * @default -1 * @supported weapp, alipay, swan, tt, qq, jd, rn @@ -90,7 +94,7 @@ interface InputProps extends StandardProps, FormItemProps { selectionEnd?: number /** 键盘弹起时,是否自动上推页面 * @default true - * @supported weapp, swan, tt, qq, jd + * @supported weapp, swan, tt, qq, jd, harmony */ adjustPosition?: boolean /** focus 时,点击页面的时候不收起键盘 @@ -171,29 +175,49 @@ interface InputProps extends StandardProps, FormItemProps { */ clueType?: number /** 当键盘输入时,触发input事件,event.detail = {value, cursor, keyCode},处理函数可以直接 return 一个字符串,将替换输入框的内容。 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onInput?: CommonEventFunction /** 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onFocus?: CommonEventFunction /** 输入框失去焦点时触发 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onBlur?: CommonEventFunction /** 点击完成按钮时触发 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onConfirm?: CommonEventFunction /** 键盘高度发生变化的时候触发此事件 - * @supported weapp, tt, qq + * @supported weapp, tt, qq, harmony */ onKeyboardHeightChange?: CommonEventFunction /** 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效,event.detail = { pass, timeout } * @supported weapp */ onNickNameReview?: CommonEventFunction + /** 选区改变事件, {selectionStart, selectionEnd} + * @supported weapp + */ + onSelectionChange?: CommonEventFunction + /** 输入法开始新的输入时触发 (仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionStart?: CommonEventFunction + /** 输入法输入字符时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionUpdate?: CommonEventFunction + /** 输入法输入结束时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionEnd?: CommonEventFunction + /** 键盘高度变化时触发。event.detail = {height: height, pageBottomPadding: pageBottomPadding}; height: 键盘高度,pageBottomPadding: 页面上推高度 + * @supported weapp + */ + onKeyoardHeightChangeWorklet?: string } declare namespace InputProps { /** Input 类型 */ diff --git a/packages/taro-components/types/Label.d.ts b/packages/taro-components/types/Label.d.ts index c212f3411c80..273ae03f566f 100644 --- a/packages/taro-components/types/Label.d.ts +++ b/packages/taro-components/types/Label.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps } from './common' interface LabelProps extends StandardProps { /** 绑定控件的 id - * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony, harmony_hybrid */ for?: string } diff --git a/packages/taro-components/types/ListView.d.ts b/packages/taro-components/types/ListView.d.ts index cb1234947e01..32d5f6ff1d93 100644 --- a/packages/taro-components/types/ListView.d.ts +++ b/packages/taro-components/types/ListView.d.ts @@ -12,7 +12,7 @@ interface ListViewProps extends StandardProps { /** * 列表布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 * @classification skyline - * @supported weapp + * @supported weapp, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/list-view.html */ declare const ListView: ComponentType diff --git a/packages/taro-components/types/MatchMedia.d.ts b/packages/taro-components/types/MatchMedia.d.ts index a11f91527b5a..2a89a5e933d6 100644 --- a/packages/taro-components/types/MatchMedia.d.ts +++ b/packages/taro-components/types/MatchMedia.d.ts @@ -2,37 +2,37 @@ import { ComponentType } from 'react' import { StandardProps } from './common' interface MatchMediaProps extends StandardProps { /** 页面最小宽度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ minWidth?: number /** 页面最大宽度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ maxWidth?: number /** 页面宽度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ width?: number /** 页面最小高度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ minHeight?: number /** 页面最大高度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ maxHeight?: number /** 页面高度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ height?: number /** 屏幕方向( landscape 或 portrait ) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ orientation?: string } /** media query 匹配检测节点。可以指定一组 media query 规则,满足时,这个节点才会被展示。 * 通过这个节点可以实现“页面宽高在某个范围时才展示某个区域”这样的效果。 - * @supported weapp, alipay + * @supported weapp, alipay, jd * @classification viewContainer * @example_react * ```tsx diff --git a/packages/taro-components/types/NavigationBar.d.ts b/packages/taro-components/types/NavigationBar.d.ts index a2a1c575a9b8..254ce2877fd4 100644 --- a/packages/taro-components/types/NavigationBar.d.ts +++ b/packages/taro-components/types/NavigationBar.d.ts @@ -2,19 +2,19 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction } from './common' interface NavigationBarProps extends StandardProps { /** 导航条标题 - * @supported weapp + * @supported weapp, harmony */ title?: string /** 是否在导航条显示 loading 加载提示 - * @supported weapp + * @supported weapp, harmony */ loading?: boolean /** 导航条前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 - * @supported weapp + * @supported weapp, harmony */ frontColor?: string /** 导航条背景颜色值,有效值为十六进制颜色 - * @supported weapp + * @supported weapp, harmony */ backgroundColor?: string /** 改变导航栏颜色时的动画时长,默认为 0 (即没有动画效果) diff --git a/packages/taro-components/types/Navigator.d.ts b/packages/taro-components/types/Navigator.d.ts index d5d6d1050af1..dc0da4f41827 100644 --- a/packages/taro-components/types/Navigator.d.ts +++ b/packages/taro-components/types/Navigator.d.ts @@ -111,7 +111,7 @@ declare namespace NavigatorProps { } /** 页面链接 * @classification navig - * @supported weapp, alipay, swan, tt, qq, jd, harmony, h5, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html */ declare const Navigator: ComponentType diff --git a/packages/taro-components/types/PageContainer.d.ts b/packages/taro-components/types/PageContainer.d.ts index df909fcd7926..fabdc0d4f3e4 100644 --- a/packages/taro-components/types/PageContainer.d.ts +++ b/packages/taro-components/types/PageContainer.d.ts @@ -3,12 +3,12 @@ import { StandardProps, CommonEventFunction } from './common' interface PageContainerProps extends StandardProps { /** 是否显示容器组件 * @default false - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ show?: boolean /** 动画时长,单位毫秒 * @default 300 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ duration?: number /** z-index 层级 @@ -18,58 +18,58 @@ interface PageContainerProps extends StandardProps { zIndex?: number /** 是否显示遮罩层 * @default true - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ overlay?: boolean /** 弹出位置,可选值为 top bottom right center * @default bottom - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ position?: keyof PageContainerProps.Position /** 是否显示圆角 * @default false - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ round?: boolean /** 自定义遮罩层样式 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ overlayStyle?: string /** 自定义弹出层样式 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ customStyle?: string /** 是否在下滑一段距离后关闭 - * @supported weapp, alipay + * @supported weapp, alipay, jd * @default false */ closeOnSlideDown?: boolean /** 进入前触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onBeforeEnter?: CommonEventFunction /** 进入中触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onEnter?: CommonEventFunction /** 进入后触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onAfterEnter?: CommonEventFunction /** 离开前触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onBeforeLeave?: CommonEventFunction /** 离开中触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onLeave?: CommonEventFunction /** 离开后触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onAfterLeave?: CommonEventFunction /** 点击遮罩层时触发 - * @supported weapp, alipay + * @supported weapp, alipay, jd */ onClickOverlay?: CommonEventFunction /** 进入被打断时触发(通过 a: if 打断时不会触发)。 @@ -103,7 +103,7 @@ declare namespace PageContainerProps { * 1. tip: 当前页面最多只有 1 个容器,若已存在容器的情况下,无法增加新的容器 * 2. tip: wx.navigateBack 无法在页面栈顶调用,此时没有上一级页面 * @classification viewContainer - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn * @see https://developers.weixin.qq.com/miniprogram/dev/component/page-container.html */ declare const PageContainer: ComponentType diff --git a/packages/taro-components/types/PageMeta.d.ts b/packages/taro-components/types/PageMeta.d.ts index 72b44b73473d..f4054679eec5 100644 --- a/packages/taro-components/types/PageMeta.d.ts +++ b/packages/taro-components/types/PageMeta.d.ts @@ -6,25 +6,25 @@ interface PageMetaProps extends StandardProps { */ backgroundTextStyle?: string /** 窗口的背景色,必须为十六进制颜色值 - * @supported weapp, alipay + * @supported weapp, alipay, harmony */ backgroundColor?: string /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 - * @supported weapp, alipay + * @supported weapp, alipay, harmony */ backgroundColorTop?: string /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 - * @supported weapp, alipay + * @supported weapp, alipay, harmony */ backgroundColorBottom?: string /** 滚动位置,可以使用 px 或者 rpx 为单位,在被设置时,页面会滚动到对应位置 * @default "" - * @supported weapp, alipay + * @supported weapp, alipay, harmony */ scrollTop?: string /** 滚动动画时长 * @default 300 - * @supported weapp, alipay + * @supported weapp, alipay, harmony */ scrollDuration?: number /** 页面根节点样式,页面根节点是所有页面节点的祖先节点,相当于 HTML 中的 body 节点 @@ -38,7 +38,7 @@ interface PageMetaProps extends StandardProps { */ rootFontSize?: string /** 页面内容的背景色,用于页面中的空白部分和页面大小变化 resize 动画期间的临时空闲区域 - * @supported weapp, alipay + * @supported weapp, alipay, harmony */ rootBackgroundColor?: string /** 页面 page 的字体大小,可以设置为 system ,表示使用当前用户设置的微信字体大小 @@ -92,7 +92,7 @@ declare namespace PageMetaProps { * 开发者需要在页面配置里添加:`enablePageMeta: true` * ::: * - * @supported weapp, alipay + * @supported weapp, alipay, harmony * @example_react * ```tsx * // page.config.ts diff --git a/packages/taro-components/types/Picker.d.ts b/packages/taro-components/types/Picker.d.ts index a4e9af9f3679..59642506509b 100644 --- a/packages/taro-components/types/Picker.d.ts +++ b/packages/taro-components/types/Picker.d.ts @@ -11,7 +11,7 @@ interface PickerStandardProps extends StandardProps, FormItemProps { /** * 选择器类型,默认是普通选择器 * @default "selector" - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ mode?: keyof PickerStandardProps.Mode /** @@ -22,9 +22,14 @@ interface PickerStandardProps extends StandardProps, FormItemProps { disabled?: boolean /** * 取消选择或点遮罩层收起 picker 时触发 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ onCancel?: CommonEventFunction + /** + * 用于替换组件内部文本 + * @supported h5, harmony, harmony_hybrid + */ + textProps?: PickerStandardProps.PickerText } declare namespace PickerStandardProps { /** 选择器类型 */ @@ -51,18 +56,18 @@ interface PickerSelectorProps extends PickerStandardProps { mode?: 'selector' /** * mode为 selector 或 multiSelector 时,range 有效 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid * @default [] */ range: string[] | number[] | Record[] /** * 当 range 是一个 Object Array 时,通过 rangeKey 来指定 Object 中 key 的值作为选择器显示内容 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ rangeKey?: string /** * 表示选择了 range 中的第几个(下标从 0 开始) - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid * @default 0 */ value?: number @@ -84,14 +89,9 @@ interface PickerSelectorProps extends PickerStandardProps { indicatorStyle?: StyleProp /** * value 改变时触发 change 事件 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ onChange?: CommonEventFunction - /** - * 用于替换组件内部文本 - * @supported h5, harmony_hybrid - */ - textProps?: PickerStandardProps.PickerText } declare namespace PickerSelectorProps { interface ChangeEventDetail { @@ -105,18 +105,18 @@ interface PickerMultiSelectorProps extends PickerStandardProps { mode: 'multiSelector' /** * mode为 selector 或 multiSelector 时,range 有效 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid * @default [] */ range: Array | Array | Array[]> /** * 当 range 是一个 Object Array 时,通过 rangeKey 来指定 Object 中 key 的值作为选择器显示内容 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ rangeKey?: string /** * 表示选择了 range 中的第几个(下标从 0 开始) - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid * @default [] */ value: number[] | string[] | Record[] @@ -134,12 +134,12 @@ interface PickerMultiSelectorProps extends PickerStandardProps { indicatorStyle?: StyleProp /** * 当 value 改变时触发 change 事件 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ onChange: CommonEventFunction /** * 列改变时触发 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ onColumnChange?: CommonEventFunction } @@ -161,7 +161,7 @@ interface PickerTimeProps extends PickerStandardProps { mode: 'time' /** * value 的值表示选择了 range 中的第几个(下标从 0 开始) - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ value?: string /** 设置 React 非受控状态下的初始取值 @@ -170,17 +170,17 @@ interface PickerTimeProps extends PickerStandardProps { defaultValue?: string /** * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的开始,字符串格式为"hh:mm" - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ start?: string /** * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的结束,字符串格式为"hh:mm" - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ end?: string /** * value 改变时触发 change 事件 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ onChange: CommonEventFunction } @@ -196,7 +196,7 @@ interface PickerDateProps extends PickerStandardProps { mode: 'date' /** * 表示选中的日期,格式为"YYYY-MM-DD" - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid * @default 0 */ value: string @@ -206,12 +206,12 @@ interface PickerDateProps extends PickerStandardProps { defaultValue?: string /** * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的开始,字符串格式为"YYYY-MM-DD" - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ start?: string /** * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的结束,字符串格式为"YYYY-MM-DD" - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ end?: string /** @@ -222,7 +222,7 @@ interface PickerDateProps extends PickerStandardProps { fields?: keyof PickerDateProps.Fields /** * value 改变时触发 change 事件 - * @supported weapp, h5, rn, harmony_hybrid + * @supported weapp, h5, rn, harmony, harmony_hybrid */ onChange: CommonEventFunction } @@ -289,6 +289,7 @@ declare namespace PickerRegionProps { value: string code: string postcode?: string + children?: RegionData[] } interface Level { /** 省级选择器 */ diff --git a/packages/taro-components/types/PickerView.d.ts b/packages/taro-components/types/PickerView.d.ts index 1f9724666895..1e203d0f0aa5 100644 --- a/packages/taro-components/types/PickerView.d.ts +++ b/packages/taro-components/types/PickerView.d.ts @@ -60,7 +60,7 @@ declare namespace PickerViewProps { /** 嵌入页面的滚动选择器 * 其中只可放置 picker-view-column 组件,其它节点不会显示 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid * @example_react * ```tsx * export default class Picks extends Component { diff --git a/packages/taro-components/types/PickerViewColumn.d.ts b/packages/taro-components/types/PickerViewColumn.d.ts index 767785f68697..ad4ea1f132aa 100644 --- a/packages/taro-components/types/PickerViewColumn.d.ts +++ b/packages/taro-components/types/PickerViewColumn.d.ts @@ -5,7 +5,7 @@ type PickerViewColumnProps = StandardProps /** 滚动选择器子项 * 仅可放置于 `` 中,其孩子节点的高度会自动设置成与 picker-view 的选中框的高度一致 * @classification forms - * @supported weapp, swan, alipay, tt, h5, rn, harmony, harmony_hybrid + * @supported weapp, swan, alipay, tt, h5, rn, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/component/picker-view-column.html */ declare const PickerViewColumn: ComponentType diff --git a/packages/taro-components/types/Progress.d.ts b/packages/taro-components/types/Progress.d.ts index 6c4cb35a2ba5..2eeb570345fa 100644 --- a/packages/taro-components/types/Progress.d.ts +++ b/packages/taro-components/types/Progress.d.ts @@ -68,7 +68,7 @@ interface ProgressProps extends StandardProps { } /** 进度条。组件属性的长度单位默认为 px * @classification base - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Radio.d.ts b/packages/taro-components/types/Radio.d.ts index 16658650f3b2..5941710b4226 100644 --- a/packages/taro-components/types/Radio.d.ts +++ b/packages/taro-components/types/Radio.d.ts @@ -2,22 +2,22 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface RadioProps extends StandardProps { /** `` 标识。当该`` 选中时,``的 change 事件会携带``的 value - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ value?: string /** 当前是否选中 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ checked?: boolean /** 是否禁用 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ disabled?: boolean /** Radio 的颜色,同 css 的 color * @default "#09BB07" - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony */ color?: string /** @@ -34,7 +34,7 @@ interface RadioProps extends StandardProps { */ ariaLabel?: string /** 中的选中项发生变化时触发 change 事件 - * @supported h5, rn, harmony_hybrid + * @supported h5, rn, harmony, harmony_hybrid */ onChange?: CommonEventFunction<{ value?: string diff --git a/packages/taro-components/types/RadioGroup.d.ts b/packages/taro-components/types/RadioGroup.d.ts index 34bba0cf0456..18adf213afce 100644 --- a/packages/taro-components/types/RadioGroup.d.ts +++ b/packages/taro-components/types/RadioGroup.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface RadioGroupProps extends StandardProps, FormItemProps { /** 组件名字,用于表单提交获取数据。 - * @supported alipay, tt + * @supported alipay, tt, harmony */ name?: string /** RadioGroup 中选中项发生改变时触发 change 事件,detail = {value:[选中的radio的value的数组]} diff --git a/packages/taro-components/types/RichText.d.ts b/packages/taro-components/types/RichText.d.ts index f09f5a69e1c3..454fb0bb27a5 100644 --- a/packages/taro-components/types/RichText.d.ts +++ b/packages/taro-components/types/RichText.d.ts @@ -3,15 +3,15 @@ import { CommonEventFunction, StandardProps } from './common' interface RichTextProps extends StandardProps { /** 文本是否可选,该属性会使节点显示为 block * @default false - * @supported weapp, h5, harmony_hybrid + * @supported weapp, jd, h5, harmony_hybrid */ userSelect?: boolean /** 节点列表/ HTML String - * @supported weapp, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid + * @supported weapp, jd, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid */ nodes?: Nodes /** 显示连续空格 - * @supported weapp, alipay, tt, qq, h5, rn, harmony_hybrid + * @supported weapp, jd, alipay, tt, qq, h5, rn, harmony_hybrid */ space?: keyof RichTextProps.TSpace /** 富文本是否可以长按选中,可用于复制,粘贴,长按搜索等场景 @@ -52,6 +52,11 @@ interface RichTextProps extends StandardProps { * @supported alipay */ onLongtap?: CommonEventFunction + /** 布局兼容模式 + * @supported weapp + * @default default + */ + mode?: 'default' | 'compat' | 'aggressive' | 'inline-block' | 'web' } /** 节点类型 * > 现支持两种节点,通过type来区分,分别是元素节点和文本节点,默认是元素节点,在富文本区域里显示的HTML节点 元素节点:type = node* @@ -99,7 +104,7 @@ declare namespace RichTextProps { } /** 富文本 * @classification base - * @supported weapp, swan, alipay, tt, h5, rn, harmony, harmony_hybrid + * @supported weapp, jd, swan, alipay, tt, h5, rn, harmony, harmony_hybrid * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-components/types/ScrollView.d.ts b/packages/taro-components/types/ScrollView.d.ts index 0e1124ca3885..9cdb3871b9ff 100644 --- a/packages/taro-components/types/ScrollView.d.ts +++ b/packages/taro-components/types/ScrollView.d.ts @@ -3,13 +3,13 @@ import { BaseEventOrigFunction, CommonEventFunction, StandardProps } from './com interface ScrollViewProps extends StandardProps { /** 允许横向滚动 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @rn 二选一 */ scrollX?: boolean /** 允许纵向滚动 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @rn 二选一 */ scrollY?: boolean @@ -96,7 +96,7 @@ interface ScrollViewProps extends StandardProps { */ bounces?: boolean /** 滚动条显隐控制 (同时开启 enhanced 属性后生效) - * @supported weapp + * @supported weapp, harmony * @default true */ showScrollbar?: boolean @@ -140,10 +140,18 @@ interface ScrollViewProps extends StandardProps { * list - 列表模式。只会渲染在屏节点,会根据直接子节点是否在屏来按需渲染,若只有一个直接子节点则性能会退化 * custom - 自定义模式。只会渲染在屏节点,子节点可以是 sticky-section list-view grid-view 等组件 * nested - 嵌套模式。用于处理父子 scroll-view 间的嵌套滚动,子节点可以是 nested-scroll-header nested-scroll-body 组件或自定义 refresher - * @supported weapp + * @supported weapp, harmony * @default 'list' */ type?: 'list' | 'custom' | 'nested' + /** 关联的滚动容器 + * draggable-sheet - 关联 draggable-sheet 组件 3.2.0 + * nested-scroll-view - 关联 type=nested 嵌套模式 3.2.0 + * pop-gesture - 关联 页面手势返回 3.4.0 + * @supported weapp + * @default '' + */ + associativeContainer?: 'draggable-sheet' | 'nested-scroll-view' | 'pop-gesture' /** 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。 * @supported weapp * @default false @@ -226,7 +234,7 @@ interface ScrollViewProps extends StandardProps { */ onScrollToLower?: CommonEventFunction /** 滚动时触发 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onScroll?: BaseEventOrigFunction /** 滚动开始事件 @@ -289,6 +297,22 @@ interface ScrollViewProps extends StandardProps { * @supported alipay */ onTouchCancel?: CommonEventFunction + /** 同 bindscrollstart,但仅支持 worklet 作为回调 + * @supported weapp + */ + onScrollStartWorklet?: string + /** 同 bindscroll ,但仅支持 worklet 作为回调 + * @supported weapp + */ + onScrollUpdateWorklet?: string + /** 同 bindscrollend,但仅支持 worklet 作为回调 + * @supported weapp + */ + onScrollEndWorklet?: string + /** 指定手指抬起时做惯性滚动的初速度。(velocity: number) => number + * @supported weapp + */ + adjustDecelerationVelocityWorklet?: string } declare namespace ScrollViewProps { interface onScrollDetail { diff --git a/packages/taro-components/types/ShareElement.d.ts b/packages/taro-components/types/ShareElement.d.ts index 79530a366c9e..4b00ba995ea2 100644 --- a/packages/taro-components/types/ShareElement.d.ts +++ b/packages/taro-components/types/ShareElement.d.ts @@ -59,11 +59,11 @@ interface ShareElementProps extends StandardProps { | 'bounceIn' | 'bounceOut' | 'bounceInOut' - | 'cubic-bezier(x1,' + | 'cubic-bezier(x1, y1, x2, y2)' /** 动画帧回调 * @supported weapp */ - onFrame?: string + onFrameWorklet?: string } /** 共享元素 * diff --git a/packages/taro-components/types/Slider.d.ts b/packages/taro-components/types/Slider.d.ts index 6d95bd3ec4a5..7fa28d638be8 100644 --- a/packages/taro-components/types/Slider.d.ts +++ b/packages/taro-components/types/Slider.d.ts @@ -3,27 +3,27 @@ import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface SliderProps extends StandardProps, FormItemProps { /** 最小值 * @default 0 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ min?: number /** 最大值 * @default 100 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ max?: number /** 步长,取值必须大于 0,并且可被(max - min)整除 * @default 1 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ step?: number /** 是否禁用 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ disabled?: boolean /** 当前取值 * @default 0 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ value?: number /** 设置 React 非受控状态下的初始取值 @@ -33,37 +33,37 @@ interface SliderProps extends StandardProps, FormItemProps { defaultValue?: string /** 背景条的颜色(请使用 backgroundColor) * @default "#e9e9e9" - * @supported weapp, tt, qq, jd + * @supported weapp, tt, qq, jd, harmony */ color?: string /** 已选择的颜色(请使用 activeColor) * @default "#1aad19" - * @supported weapp, tt, qq, jd + * @supported weapp, tt, qq, jd, harmony */ selectedColor?: string /** 已选择的颜色 * @default "#1aad19" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ activeColor?: string /** 背景条的颜色 * @default "#e9e9e9" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ backgroundColor?: string /** 滑块的大小,取值范围为 12 - 28 * @default 28 - * @supported weapp, swan, tt, qq, jd, h5, harmony_hybrid + * @supported weapp, swan, tt, qq, jd, h5, harmony, harmony_hybrid */ blockSize?: number /** 滑块的颜色 * @default "#ffffff" - * @supported weapp, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ blockColor?: string /** 是否显示当前 value * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ showValue?: boolean /** 组件名字,用于表单提交获取数据。 @@ -89,11 +89,11 @@ interface SliderProps extends StandardProps, FormItemProps { */ ariaLabel?: string /** 完成一次拖动后触发的事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onChange?: CommonEventFunction /** 拖动过程中触发的事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onChanging?: CommonEventFunction } diff --git a/packages/taro-components/types/Slot.d.ts b/packages/taro-components/types/Slot.d.ts index f3a47059392a..5739ea151900 100644 --- a/packages/taro-components/types/Slot.d.ts +++ b/packages/taro-components/types/Slot.d.ts @@ -17,7 +17,7 @@ interface SlotProps extends StandardProps { /** slot 插槽 * @classification viewContainer - * @supported weapp, swan, alipay, tt, jd, qq, harmony, h5, harmony_hybrid + * @supported weapp, swan, alipay, tt, jd, qq, h5, harmony_hybrid * @example * ```tsx * import { Slot, View, Text } from '@tarojs/components' diff --git a/packages/taro-components/types/StickyHeader.d.ts b/packages/taro-components/types/StickyHeader.d.ts index 87cc3c6f0860..df5ead076e98 100644 --- a/packages/taro-components/types/StickyHeader.d.ts +++ b/packages/taro-components/types/StickyHeader.d.ts @@ -13,12 +13,18 @@ interface StickyHeaderProps extends StandardProps { * @default [0, 0, 0, 0] */ padding?: [number, number, number, number] + /** + * 吸顶状态变化事件,仅支持非 worklet 的组件方法作为回调。event.detail = { isStickOnTop },当 sticky-header 吸顶时为 true,否则为 false。 + * @supported weapp + * @version >=3.6.2 + */ + onStickOnTopChange?: CommonEventFunction } /** * 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 * @classification skyline - * @supported weapp + * @supported weapp, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/sticky-header.html */ declare const StickyHeader: ComponentType diff --git a/packages/taro-components/types/StickySection.d.ts b/packages/taro-components/types/StickySection.d.ts index 8c1e7e2d6a16..d7396a026bff 100644 --- a/packages/taro-components/types/StickySection.d.ts +++ b/packages/taro-components/types/StickySection.d.ts @@ -16,7 +16,7 @@ interface StickySectionProps extends StandardProps { /** * 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点。仅 Skyline 支持。 * @classification skyline - * @supported weapp + * @supported weapp, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/sticky-section.html */ declare const StickySection: ComponentType diff --git a/packages/taro-components/types/Swiper.d.ts b/packages/taro-components/types/Swiper.d.ts index e3e546204cb6..a9eed8ba9c66 100644 --- a/packages/taro-components/types/Swiper.d.ts +++ b/packages/taro-components/types/Swiper.d.ts @@ -3,27 +3,27 @@ import { StandardProps, CommonEventFunction } from './common' interface SwiperProps extends StandardProps { /** 是否显示面板指示点 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ indicatorDots?: boolean /** 指示点颜色 * @default "rgba(0, 0, 0, .3)" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ indicatorColor?: string /** 当前选中的指示点颜色 * @default "#000000" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ indicatorActiveColor?: string /** 是否自动切换 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ autoplay?: boolean /** 当前所在滑块的 index * @default 0 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ current?: number /** 当前所在滑块的 item-id ,不能与 current 被同时指定 @@ -34,12 +34,12 @@ interface SwiperProps extends StandardProps { currentItemId?: string /** 自动切换时间间隔 * @default 5000 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ interval?: number /** 滑动动画时长 * @default 500 - * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony, harmony_hybrid */ duration?: number /** 是否采用衔接滑动 @@ -49,7 +49,7 @@ interface SwiperProps extends StandardProps { circular?: boolean /** 滑动方向是否为纵向 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ vertical?: boolean /** 前边距,可用于露出前一项的一小部分,接受 px 和 rpx 值 @@ -141,18 +141,12 @@ interface SwiperProps extends StandardProps { * @supported swan */ disableTouchmove?: string - /** 改变 current 时使用动画过渡 - * @supported weapp - * @default true - */ - scrollWithAnimation?: boolean - /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) - * @supported weapp - * @default 0 - */ - cacheExtent?: number + /** swiper11 相关的动效参数,具体见文档 https://swiperjs.com/swiper-api#parameters + * @supported h5 + */ + effectsProps?: Record /** current 改变时会触发 change 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onChange?: CommonEventFunction /** swiper-item 的位置发生改变时会触发 transition 事件 @@ -167,6 +161,78 @@ interface SwiperProps extends StandardProps { * @supported alipay */ onAnimationEnd?: CommonEventFunction + /** 渲染模式 + * @supported weapp + * @default normal + */ + layoutType?: 'normal' | 'stackLeft' | 'stackRight' | 'tinder' | 'transformer' + /** layout-type 为 transformer 时指定动画类型 + * @supported weapp + * @default scaleAndFade + */ + transformerType?: 'scaleAndFade' | 'accordion' | 'threeD' | 'zoomIn' | 'zoomOut' | 'deepthPage' + /** 指示点动画类型 + * @supported weapp + * @default normal + */ + indicatorType?: 'normal' | 'worm' | 'wormThin' | 'wormUnderground' | 'wormThinUnderground' | 'expand' | 'jump' | 'jumpWithOffset' | 'scroll' | 'scrollFixedCenter' | 'slide' | 'slideUnderground' | 'scale' | 'swap' | 'swapYRotation' | 'color' + /** 指示点四周边距 + * @supported weapp + * @default 10 + */ + indicatorMargin?: number + /** 指示点间距 + * @supported weapp + * @default 4 + */ + indicatorSpacing?: number + /** 指示点圆角大小 + * @supported weapp + * @default 4 + */ + indicatorRadius?: number + /** 指示点宽度 + * @supported weapp + * @default 8 + */ + indicatorWidth?: number + /** 指示点高度 + * @supported weapp + * @default 8 + */ + indicatorHeight?: number + /** 指示点的相对位置 + * @supported weapp + * @default auto + */ + indicatorAlignment?: [number, number] | string + /** 指示点位置的偏移量 + * @supported weapp + * @default [0, 0] + */ + indicatorOffset?: [number, number] + /** 改变 current 时使用动画过渡 + * @supported weapp + * @default true + */ + scrollWithAnimation?: boolean + /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) + * @supported weapp + * @default 0 + */ + cacheExtent?: number + /** 滑动开始时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} + * @supported weapp + */ + onScrollStartWorklet?: string + /** 滑动位置更新时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} + * @supported weapp + */ + onScrollUpdateWorklet?: string + /** 滑动结束时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} + * @supported weapp + */ + onScrollEndWorklet?: string } declare namespace SwiperProps { /** 导致变更的原因 */ diff --git a/packages/taro-components/types/SwiperItem.d.ts b/packages/taro-components/types/SwiperItem.d.ts index c8908eea1440..18f2e6421615 100644 --- a/packages/taro-components/types/SwiperItem.d.ts +++ b/packages/taro-components/types/SwiperItem.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps } from './common' interface SwiperItemProps extends StandardProps { /** 该 swiper-item 的标识符 - * @supported weapp, swan, tt, jd, h5, rn, harmony_hybrid + * @supported weapp, swan, tt, jd, h5, rn, harmony, harmony_hybrid */ itemId?: string /** 是否跳过未显示的滑块布局,设为 true 可优化复杂情况下的滑动性能,但会丢失隐藏状态滑块的布局信息 diff --git a/packages/taro-components/types/Switch.d.ts b/packages/taro-components/types/Switch.d.ts index e3bd221ed737..199d4fb4f377 100644 --- a/packages/taro-components/types/Switch.d.ts +++ b/packages/taro-components/types/Switch.d.ts @@ -3,7 +3,7 @@ import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface SwitchProps extends StandardProps, FormItemProps { /** 是否选中 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ checked?: boolean /** 设置在 React 非受控状态下,当前是否选中 @@ -13,17 +13,17 @@ interface SwitchProps extends StandardProps, FormItemProps { defaultChecked?: boolean /** 是否禁用 * @default false - * @supported weapp, alipay, swan, tt, qq, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid */ disabled?: boolean /** 样式,有效值:switch, checkbox * @default "switch" - * @supported weapp, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ type?: 'switch' | 'checkbox' /** switch 的颜色,同 css 的 color * @default "#04BE02" - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ color?: string /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上 @@ -44,7 +44,7 @@ interface SwitchProps extends StandardProps, FormItemProps { */ ariaLabel?: string /** checked 改变时触发 change 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onChange?: CommonEventFunction } diff --git a/packages/taro-components/types/Text.d.ts b/packages/taro-components/types/Text.d.ts index eb8fa9b4be12..883edfb07d21 100644 --- a/packages/taro-components/types/Text.d.ts +++ b/packages/taro-components/types/Text.d.ts @@ -27,12 +27,12 @@ interface TextProps extends StandardProps { numberOfLines?: number /** * 文本溢出处理 - * @supported weapp-skyline + * @supported weapp * @default 'visible' */ overflow?: keyof TextProps.Overflow /** 限制文本最大行数 - * @supported weapp + * @supported weapp, harmony */ maxLines?: number } @@ -59,7 +59,7 @@ declare namespace TextProps { } /** 文本 * @classification base - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Textarea.d.ts b/packages/taro-components/types/Textarea.d.ts index f9fb83a96bd9..a70e745b580e 100644 --- a/packages/taro-components/types/Textarea.d.ts +++ b/packages/taro-components/types/Textarea.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface TextareaProps extends StandardProps, FormItemProps { /** 输入框的内容 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ value?: string /** 设置 React 非受控输入框的初始内容 @@ -11,11 +11,11 @@ interface TextareaProps extends StandardProps, FormItemProps { */ defaultValue?: string /** 输入框为空时占位符 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ placeholder?: string /** 指定 placeholder 的样式 - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, harmony */ placeholderStyle?: string /** 指定 placeholder 的样式类 @@ -129,11 +129,11 @@ interface TextareaProps extends StandardProps, FormItemProps { */ adjustKeyboardTo?: boolean /** 输入框聚焦时触发 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onFocus?: CommonEventFunction /** 输入框失去焦点时触发 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onBlur?: CommonEventFunction /** 输入框行数变化时调用 @@ -143,7 +143,7 @@ interface TextareaProps extends StandardProps, FormItemProps { /** 当键盘输入时,触发 input 事件 * * **onInput 处理函数的返回值并不会反映到 textarea 上** - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onInput?: CommonEventFunction /** 点击完成时, 触发 confirm 事件 @@ -151,9 +151,30 @@ interface TextareaProps extends StandardProps, FormItemProps { */ onConfirm?: CommonEventFunction /** 键盘高度发生变化的时候触发此事件 - * @supported weapp, tt + * @supported weapp, tt, harmony */ onKeyboardHeightChange?: CommonEventFunction + + /** 需传入对象,格式为 { fontSize: number, fontWeight: string, color: string } + * @supported weapp + */ + placeholderStyle?: string + /** 选区改变事件, {selectionStart, selectionEnd} + * @supported weapp + */ + onSelectionChange?: CommonEventFunction + /** 输入法开始新的输入时触发 (仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionStart?: CommonEventFunction + /** 输入法输入字符时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionUpdate?: CommonEventFunction + /** 输入法输入结束时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionEnd?: CommonEventFunction } declare namespace TextareaProps { interface onFocusEventDetail { diff --git a/packages/taro-components/types/Video.d.ts b/packages/taro-components/types/Video.d.ts index a6d4e77022fa..fe40bded39e2 100644 --- a/packages/taro-components/types/Video.d.ts +++ b/packages/taro-components/types/Video.d.ts @@ -2,16 +2,16 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction } from './common' interface VideoProps extends StandardProps { /** 要播放视频的资源地址 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ src: string /** 指定视频时长 - * @supported weapp, alipay, qq, h5, rn, harmony_hybrid + * @supported weapp, alipay, qq, h5, rn, harmony, harmony_hybrid */ duration?: number /** 是否显示默认播放控件(播放/暂停按钮、播放进度、时间) * @default true - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ controls?: boolean /** 弹幕列表 @@ -30,17 +30,17 @@ interface VideoProps extends StandardProps { enableDanmu?: boolean /** 是否自动播放 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ autoplay?: boolean /** 是否循环播放 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ loop?: boolean /** 是否静音播放 * @default false - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ muted?: boolean /** 指定视频初始播放位置 @@ -83,7 +83,7 @@ interface VideoProps extends StandardProps { enableProgressGesture?: boolean /** 当视频大小与 video 容器大小不一致时,视频的表现形式 * @default "contain" - * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, harmony, harmony_hybrid */ objectFit?: keyof VideoProps.ObjectFit /** 视频封面的图片网络资源地址,如果 controls 属性值为 false 则设置 poster 无效 @@ -298,24 +298,24 @@ interface VideoProps extends StandardProps { */ definition?: string /** 当开始/继续播放时触发 play 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onPlay?: CommonEventFunction /** 当暂停播放时触发 pause 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onPause?: CommonEventFunction /** 当播放到末尾时触发 ended 事件 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onEnded?: CommonEventFunction /** 播放进度变化时触发, 触发频率 250ms 一次 - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid */ onTimeUpdate?: CommonEventFunction /** 当视频进入和退出全屏时触发 * - * @supported alipay, h5, rn, harmony_hybrid + * @supported alipay, h5, rn, harmony, harmony_hybrid */ onFullscreenChange?: CommonEventFunction /** 视频出现缓冲时触发 @@ -328,11 +328,11 @@ interface VideoProps extends StandardProps { */ onError?: CommonEventFunction /** 加载进度变化时触发,只支持一段加载 - * @supported weapp, tt, qq, h5, harmony_hybrid + * @supported weapp, tt, qq, h5, harmony, harmony_hybrid */ onProgress?: CommonEventFunction /** 视频元数据加载完成时触发 - * @supported weapp, swan, tt, jd, rn + * @supported weapp, swan, tt, jd, rn, harmony */ onLoadedMetaData?: CommonEventFunction /** @@ -433,11 +433,11 @@ interface VideoProps extends StandardProps { */ onLoadStart?: CommonEventFunction /** 否 - * @supported jd + * @supported jd, harmony */ onSeeked?: CommonEventFunction /** 否 - * @supported jd + * @supported jd, harmony */ onSeeking?: CommonEventFunction /** 贴片广告加载成功时触发,event.detail = { adType: 'preRollAd' | 'postRollAd' } diff --git a/packages/taro-components/types/common.d.ts b/packages/taro-components/types/common.d.ts index ccd56263e377..d22bd1397a9c 100644 --- a/packages/taro-components/types/common.d.ts +++ b/packages/taro-components/types/common.d.ts @@ -1,9 +1,10 @@ import { CSSProperties, LegacyRef, ReactNode } from 'react' +import { COMPILE_MODE_SUB_RENDER_FN } from '@tarojs/shared' export interface StandardProps = ITouchEvent> extends EventProps { /** 组件的唯一标示, 保持整个页面唯一 */ id?: string - /** 同 `class`,在 React/Nerv 里一般使用 `className` 作为 `class` 的代称 */ + /** 同 `class`,在 React/Preact 里一般使用 `className` 作为 `class` 的代称 */ className?: string /** 组件的内联样式, 可以动态设置的内联样式 */ style?: string | CSSProperties @@ -27,10 +28,15 @@ export interface StandardProps = __html: string } /** - * 是否开启编译模式 + * 是否开启编译模式 或者 是否是编译模式的子渲染函数 * @supported weapp, harmony */ - compileMode?: boolean + compileMode?: boolean | string | typeof COMPILE_MODE_SUB_RENDER_FN + /** + * 自定义容器组件的方向 + * @supported harmony + */ + harmonyDirection?: 'row' | 'column' | 'flex' } export interface FormItemProps { diff --git a/packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts b/packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts new file mode 100644 index 000000000000..3c20c8ec337a --- /dev/null +++ b/packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface DoubleTapGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/** 双击时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, DoubleTapGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const DoubleTapGestureHandler: ComponentType + +export { DoubleTapGestureHandler, DoubleTapGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts b/packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts new file mode 100644 index 000000000000..c36aec9a465b --- /dev/null +++ b/packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts @@ -0,0 +1,49 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface ForcePressGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**iPhone 设备重按时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, ForcePressGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const ForcePressGestureHandler: ComponentType + +export { ForcePressGestureHandler, ForcePressGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts b/packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts new file mode 100644 index 000000000000..dce2509d440a --- /dev/null +++ b/packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface HorizontalDragGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**横向滑动时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, HorizontalDragGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const HorizontalDragGestureHandler: ComponentType + +export { HorizontalDragGestureHandler, HorizontalDragGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/LongPressGestureHandler.d.ts b/packages/taro-components/types/gesture/LongPressGestureHandler.d.ts new file mode 100644 index 000000000000..567c64a1457d --- /dev/null +++ b/packages/taro-components/types/gesture/LongPressGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface LongPressGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**长按时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, LongPressGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const LongPressGestureHandler: ComponentType + +export { LongPressGestureHandler, LongPressGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/PanGestureHandler.d.ts b/packages/taro-components/types/gesture/PanGestureHandler.d.ts new file mode 100644 index 000000000000..1318dc91edca --- /dev/null +++ b/packages/taro-components/types/gesture/PanGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface PanGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**拖动(横向/纵向)时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, PanGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const PanGestureHandler: ComponentType + +export { PanGestureHandler, PanGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/ScaleGestureHandler.d.ts b/packages/taro-components/types/gesture/ScaleGestureHandler.d.ts new file mode 100644 index 000000000000..370396eefa7f --- /dev/null +++ b/packages/taro-components/types/gesture/ScaleGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface ScaleGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**多指缩放时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, ScaleGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const ScaleGestureHandler: ComponentType + +export { ScaleGestureHandler, ScaleGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/TapGestureHandler.d.ts b/packages/taro-components/types/gesture/TapGestureHandler.d.ts new file mode 100644 index 000000000000..c9286f9920ec --- /dev/null +++ b/packages/taro-components/types/gesture/TapGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface TapGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**点击时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, TapGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const TapGestureHandler: ComponentType + +export { TapGestureHandler, TapGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts b/packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts new file mode 100644 index 000000000000..4521ec9ad122 --- /dev/null +++ b/packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface VerticalDragGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**纵向滑动时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, VerticalDragGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const VerticalDragGestureHandler: ComponentType + +export { VerticalDragGestureHandler, VerticalDragGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/common.d.ts b/packages/taro-components/types/gesture/common.d.ts new file mode 100644 index 000000000000..944c8847716c --- /dev/null +++ b/packages/taro-components/types/gesture/common.d.ts @@ -0,0 +1,26 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +export interface CommonGestureProps { + /** 声明手势协商时的组件标识 + * @supported weapp-skyline + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp-skyline + */ + onGestureWorklet?: string + /** 手势是否应该被识别 + * @supported weapp-skyline + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp-skyline + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp-skyline + */ + nativeView?: string +} diff --git a/packages/taro-components/types/global.d.ts b/packages/taro-components/types/global.d.ts new file mode 100644 index 000000000000..2760158fb402 --- /dev/null +++ b/packages/taro-components/types/global.d.ts @@ -0,0 +1,4 @@ +declare module 'swiper/bundle' { + import Swiper from 'swiper'; + export = Swiper +} \ No newline at end of file diff --git a/packages/taro-components/types/index.d.ts b/packages/taro-components/types/index.d.ts index ac618d98119a..3405a60a4573 100644 --- a/packages/taro-components/types/index.d.ts +++ b/packages/taro-components/types/index.d.ts @@ -15,6 +15,7 @@ export { ScrollView } from './ScrollView' export { Swiper } from './Swiper' export { SwiperItem } from './SwiperItem' export { View } from './View' +export { AnimationView } from './AnimationView' /** 基础内容 */ export { Icon } from './Icon' @@ -41,6 +42,14 @@ export { Switch } from './Switch' export { Textarea } from './Textarea' /** Skyline */ +export { DoubleTapGestureHandler } from './gesture/DoubleTapGestureHandler' +export { ForcePressGestureHandler } from './gesture/ForcePressGestureHandler' +export { HorizontalDragGestureHandler } from './gesture/HorizontalDragGestureHandler' +export { LongPressGestureHandler } from './gesture/LongPressGestureHandler' +export { PanGestureHandler } from './gesture/PanGestureHandler' +export { ScaleGestureHandler } from './gesture/ScaleGestureHandler' +export { TapGestureHandler } from './gesture/TapGestureHandler' +export { VerticalDragGestureHandler } from './gesture/VerticalDragGestureHandler' export { GridView } from './GridView' export { GridBuilder } from './GridBuilder' export { ListView } from './ListView' @@ -59,20 +68,25 @@ export { NestedScrollBody } from './NestedScrollBody' export { FunctionalPageNavigator } from './FunctionalPageNavigator' export { Navigator } from './Navigator' export { NavigationBar } from './NavigationBar' +export { Tabs } from './Tabs' // export { Tabbar } from './Tabbar' // export { TabbarItem } from './TabbarItem' /** 媒体组件 */ export { Audio } from './Audio' export { Camera } from './Camera' +export { ArCamera } from './ArCamera' export { ChannelLive } from './ChannelLive' export { ChannelVideo } from './ChannelVideo' export { Image } from './Image' export { LivePlayer } from './LivePlayer' export { LivePusher } from './LivePusher' export { Video } from './Video' +export { AnimationVideo } from './AnimationVideo' export { VoipRoom } from './VoipRoom' export { Lottie } from './Lottie' +export { RtcRoom } from './RtcRoom' +export { RtcRoomItem } from './RtcRoomItem' /** 地图 */ export { Map } from './Map' @@ -82,15 +96,29 @@ export { Canvas } from './Canvas' /** 开放能力 */ export { Ad } from './Ad' +export { AwemeData } from './AwemeData' export { AdCustom } from './AdCustom' export { OfficialAccount } from './OfficialAccount' export { OpenData } from './OpenData' export { WebView } from './WebView' +export { FollowSwan } from './FollowSwan' +export { InlinePaymentPanel } from './InlinePaymentPanel' +export { Lifestyle } from './Lifestyle' +export { Login } from './Login' /** 配置节点 */ export { PageMeta } from './PageMeta' +/** 内容服务组件 **/ +export { CommentDetail } from './CommentDetail' +export { CommentList } from './CommentList' +export { Like } from './Like' + +/** 客服能力 **/ +export { ContactButton } from './ContactButton' + export { CustomWrapper } from './CustomWrapper' export { Slot } from './Slot' export { NativeSlot } from './NativeSlot' export { Script } from './Script' +export { PullToRefresh } from './PullToRefresh' diff --git a/packages/taro-components/types/index.solid.d.ts b/packages/taro-components/types/index.solid.d.ts new file mode 100644 index 000000000000..0243ba04f554 --- /dev/null +++ b/packages/taro-components/types/index.solid.d.ts @@ -0,0 +1,297 @@ +import { JSX, JSXElement } from 'solid-js' +import { TaroElement } from '@tarojs/runtime' +import { AdProps } from '@tarojs/components/types/Ad' +import { AdCustomProps } from '@tarojs/components/types/AdCustom' +import { AudioProps } from '@tarojs/components/types/Audio' +import { ButtonProps } from '@tarojs/components/types/Button' +import { CameraProps } from '@tarojs/components/types/Camera' +import { CanvasProps } from '@tarojs/components/types/Canvas' +import { ChannelLiveProps } from '@tarojs/components/types/ChannelLive' +import { ChannelVideoProps } from '@tarojs/components/types/ChannelVideo' +import { CheckboxProps } from '@tarojs/components/types/Checkbox' +import { CheckboxGroupProps } from '@tarojs/components/types/CheckboxGroup' +import { StandardProps } from '@tarojs/components/types/common' +import { CoverImageProps } from '@tarojs/components/types/CoverImage' +import { CoverViewProps } from '@tarojs/components/types/CoverView' +import { CustomWrapperProps } from '@tarojs/components/types/CustomWrapper' +import { EditorProps } from '@tarojs/components/types/Editor' +import { FormProps } from '@tarojs/components/types/Form' +import { FunctionalPageNavigatorProps } from '@tarojs/components/types/FunctionalPageNavigator' +import { GridViewProps } from '@tarojs/components/types/GridView' +import { IconProps } from '@tarojs/components/types/Icon' +import { ImageProps } from '@tarojs/components/types/Image' +import { InputProps } from '@tarojs/components/types/Input' +import { KeyboardAccessoryProps } from '@tarojs/components/types/KeyboardAccessory' +import { LabelProps } from '@tarojs/components/types/Label' +import { ListViewProps } from '@tarojs/components/types/ListView' +import { LivePlayerProps } from '@tarojs/components/types/LivePlayer' +import { LivePusherProps } from '@tarojs/components/types/LivePusher' +import { MapProps } from '@tarojs/components/types/Map' +import { MatchMediaProps } from '@tarojs/components/types/MatchMedia' +import { MovableAreaProps } from '@tarojs/components/types/MovableArea' +import { MovableViewProps } from '@tarojs/components/types/MovableView' +import { NativeSlotProps } from '@tarojs/components/types/NativeSlot' +import { NavigationBarProps } from '@tarojs/components/types/NavigationBar' +import { NavigatorProps } from '@tarojs/components/types/Navigator' +import { OfficialAccountProps } from '@tarojs/components/types/OfficialAccount' +import { OpenDataProps } from '@tarojs/components/types/OpenData' +import { PageContainerProps } from '@tarojs/components/types/PageContainer' +import { PageMetaProps } from '@tarojs/components/types/PageMeta' +import { + PickerDateProps, PickerMultiSelectorProps, + PickerRegionProps, PickerSelectorProps, PickerTimeProps +} from '@tarojs/components/types/Picker' +import { PickerViewProps } from '@tarojs/components/types/PickerView' +import { PickerViewColumnProps } from '@tarojs/components/types/PickerViewColumn' +import { ProgressProps } from '@tarojs/components/types/Progress' +import { RadioProps } from '@tarojs/components/types/Radio' +import { RadioGroupProps } from '@tarojs/components/types/RadioGroup' +import { RichTextProps } from '@tarojs/components/types/RichText' +import { RootPortalProps } from '@tarojs/components/types/RootPortal' +import { ScrollViewProps } from '@tarojs/components/types/ScrollView' +import { ShareElementProps } from '@tarojs/components/types/ShareElement' +import { SliderProps } from '@tarojs/components/types/Slider' +import { SlotProps } from '@tarojs/components/types/Slot' +import { SnapshotProps } from '@tarojs/components/types/SnapShot' +import { StickyHeaderProps } from '@tarojs/components/types/StickyHeader' +import { StickySectionProps } from '@tarojs/components/types/StickySection' +import { SwiperProps } from '@tarojs/components/types/Swiper' +import { SwiperItemProps } from '@tarojs/components/types/SwiperItem' +import { SwitchProps } from '@tarojs/components/types/Switch' +import { TextProps } from '@tarojs/components/types/Text' +import { TextareaProps } from '@tarojs/components/types/Textarea' +import { VideoProps } from '@tarojs/components/types/Video' +import { ViewProps } from '@tarojs/components/types/View' +import { VoipRoomProps } from '@tarojs/components/types/VoipRoom' +import { WebViewProps } from '@tarojs/components/types/WebView' + +// 重置react的类型 +interface SlimProps { + children?: JSXElement + class?: string + style?: string | JSX.CSSProperties | undefined + innerHTML?: string +} +/** 联合类型不能用omit(比如picker) */ +type DistributiveOmit = T extends unknown ? Omit : never + +export type RemoveReactAttribute = 'children' | 'className' | 'style' | 'key' | 'ref' | 'dangerouslySetInnerHTML' + +export type TransformReact2SolidType

> = DistributiveOmit & SlimProps & JSX.DirectiveAttributes & JSX.CustomAttributes + +type Components = (props: TransformReact2SolidType) => JSXElement; + + +/** 视图容器 */ +export declare const Block: Components +export declare const CoverImage: Components +export declare const CoverView: Components +export declare const GridView: Components +export declare const ListView: Components +export declare const MatchMedia: Components +export declare const MovableArea: Components +export declare const MovableView: Components +export declare const PageContainer: Components +export declare const RootPortal: Components +export declare const ScrollView: Components +export declare const ShareElement: Components +export declare const StickyHeader: Components +export declare const StickySection: Components +export declare const Swiper: Components +export declare const SwiperItem: Components +export declare const View: Components +/** 基础内容 */ +export declare const Icon: Components +export declare const Progress: Components +export declare const RichText: Components +export declare const Text: Components +/** 表单组件 */ +export declare const Button: Components +export declare const Checkbox: Components +export declare const CheckboxGroup: Components +export declare const Editor: Components +export declare const Form: Components +export declare const Input: Components +export declare const KeyboardAccessory: Components +export declare const Label: Components +export declare const Picker: Components +export declare const PickerView: Components +export declare const PickerViewColumn: Components +export declare const Radio: Components +export declare const RadioGroup: Components +export declare const Slider: Components +export declare const Switch: Components +export declare const Textarea: Components +/** 导航 */ +export declare const FunctionalPageNavigator: Components +export declare const Navigator: Components +export declare const NavigationBar: Components +/** 媒体组件 */ +export declare const Audio: Components +export declare const Camera: Components +export declare const ChannelLive: Components +export declare const ChannelVideo: Components +export declare const Image: Components +export declare const LivePlayer: Components +export declare const LivePusher: Components +export declare const Video: Components +export declare const VoipRoom: Components +/** 地图 */ +export declare const Map: Components +/** 画布 */ +export declare const Canvas: Components +/** 开放能力 */ +export declare const Ad: Components +export declare const AdCustom: Components +export declare const OfficialAccount: Components +export declare const OpenData: Components +export declare const WebView: Components +/** 配置节点 */ +export declare const PageMeta: Components + +export declare const CustomWrapper: Components +export declare const Slot: Components +export declare const NativeSlot: Components + +declare global { + namespace JSX { + interface IntrinsicElements { + /** 视图容器 */ + block: TransformReact2SolidType + 'taro-block-core': TransformReact2SolidType + 'cover-image': TransformReact2SolidType + 'taro-cover-image-core': TransformReact2SolidType + 'cover-view': TransformReact2SolidType + 'taro-cover-view-core': TransformReact2SolidType + 'match-media': TransformReact2SolidType + 'taro-match-media-core': TransformReact2SolidType + 'movable-area': TransformReact2SolidType + 'taro-movable-area-core': TransformReact2SolidType + 'movable-view': TransformReact2SolidType + 'taro-movable-view-core': TransformReact2SolidType + 'page-container': TransformReact2SolidType + 'taro-page-container-core': TransformReact2SolidType + 'root-portal': TransformReact2SolidType + 'taro-root-portal-core': TransformReact2SolidType + 'scroll-view': TransformReact2SolidType + 'taro-scroll-view-core': TransformReact2SolidType + swiper: TransformReact2SolidType + 'taro-swiper-core': TransformReact2SolidType + 'swiper-item': TransformReact2SolidType + 'taro-swiper-item-core': TransformReact2SolidType + view: TransformReact2SolidType + 'taro-view-core': TransformReact2SolidType + /** 基础内容 */ + icon: TransformReact2SolidType + 'taro-icon-core': TransformReact2SolidType + progress: TransformReact2SolidType + 'taro-progress-core': TransformReact2SolidType + 'rich-text': TransformReact2SolidType + 'taro-rich-text-core': TransformReact2SolidType + text: TransformReact2SolidType + 'taro-text-core': TransformReact2SolidType + /** 表单组件 */ + button: TransformReact2SolidType + 'taro-button-core': TransformReact2SolidType + checkbox: TransformReact2SolidType + 'taro-checkbox-core': TransformReact2SolidType + 'checkbox-group': TransformReact2SolidType + 'taro-checkbox-group-core': TransformReact2SolidType + editor: TransformReact2SolidType + 'taro-editor-core': TransformReact2SolidType + form: TransformReact2SolidType + 'taro-form-core': TransformReact2SolidType + input: TransformReact2SolidType + 'taro-input-core': TransformReact2SolidType + 'keyboard-accessory': TransformReact2SolidType + 'taro-keyboard-accessory-core': TransformReact2SolidType + label: TransformReact2SolidType + 'taro-label-core': TransformReact2SolidType + picker: TransformReact2SolidType + 'taro-picker-core': TransformReact2SolidType + 'picker-view': TransformReact2SolidType + 'taro-picker-view-core': TransformReact2SolidType + 'picker-view-column': TransformReact2SolidType + 'taro-picker-view-column-core': TransformReact2SolidType + radio: TransformReact2SolidType + 'taro-radio-core': TransformReact2SolidType + 'radio-group': TransformReact2SolidType + 'taro-radio-group-core': TransformReact2SolidType + slider: TransformReact2SolidType + 'taro-slider-core': TransformReact2SolidType + switch: TransformReact2SolidType + 'taro-switch-core': TransformReact2SolidType + textarea: TransformReact2SolidType + 'taro-textarea-core': TransformReact2SolidType + /** Skyline */ + 'grid-view': TransformReact2SolidType + 'taro-grid-view-core': TransformReact2SolidType + 'list-view': TransformReact2SolidType + 'taro-list-view-core': TransformReact2SolidType + 'share-element': TransformReact2SolidType + 'taro-share-element-core': TransformReact2SolidType + 'snapshot': TransformReact2SolidType + 'taro-snapshot-core': TransformReact2SolidType + 'sticky-header': TransformReact2SolidType + 'taro-sticky-header-core': TransformReact2SolidType + 'sticky-section': TransformReact2SolidType + 'taro-sticky-section-core': TransformReact2SolidType + /** 导航 */ + 'functional-page-navigator': TransformReact2SolidType + 'taro-functional-page-navigator-core': TransformReact2SolidType + navigator: TransformReact2SolidType + 'taro-navigator-core': TransformReact2SolidType + 'navigation-bar': TransformReact2SolidType + 'taro-navigation-bar-core': TransformReact2SolidType + /** 媒体组件 */ + audio: TransformReact2SolidType + 'taro-audio-core': TransformReact2SolidType + camera: TransformReact2SolidType + 'taro-camera-core': TransformReact2SolidType + 'channel-live': TransformReact2SolidType + 'taro-channel-live-core': TransformReact2SolidType + 'channel-video': TransformReact2SolidType + 'taro-channel-video-core': TransformReact2SolidType + image: TransformReact2SolidType + 'taro-image-core': TransformReact2SolidType + 'live-player': TransformReact2SolidType + 'taro-live-player-core': TransformReact2SolidType + 'live-pusher': TransformReact2SolidType + 'taro-live-pusher-core': TransformReact2SolidType + video: TransformReact2SolidType + 'taro-video-core': TransformReact2SolidType + 'voip-room': TransformReact2SolidType + 'taro-voip-room-core': TransformReact2SolidType + /** 地图 */ + map: TransformReact2SolidType + 'taro-map-core': TransformReact2SolidType + /** 画布 */ + canvas: TransformReact2SolidType + 'taro-canvas-core': TransformReact2SolidType + /** 开放能力 */ + ad: TransformReact2SolidType + 'taro-ad-core': TransformReact2SolidType + 'ad-custom': TransformReact2SolidType + 'taro-ad-custom-core': TransformReact2SolidType + 'official-account': TransformReact2SolidType + 'taro-official-account-core': TransformReact2SolidType + 'open-data': TransformReact2SolidType + 'taro-open-data-core': TransformReact2SolidType + 'web-view': TransformReact2SolidType + 'taro-web-view-core': TransformReact2SolidType + /** 配置节点 */ + 'page-meta': TransformReact2SolidType + 'taro-page-meta-core': TransformReact2SolidType + + 'custom-wrapper': TransformReact2SolidType + 'taro-custom-wrapper-core': TransformReact2SolidType + /** 为了不与vue3模板默认的slot冲突,增加 Record */ + 'slot': TransformReact2SolidType & Record + 'taro-slot-core': TransformReact2SolidType + 'native-slot': TransformReact2SolidType + 'taro-native-slot-core': TransformReact2SolidType + } + } +} + + diff --git a/packages/taro/types/api/base/env.d.ts b/packages/taro/types/api/base/env.d.ts index 4af6ec22599a..2eb5a32b346f 100644 --- a/packages/taro/types/api/base/env.d.ts +++ b/packages/taro/types/api/base/env.d.ts @@ -9,7 +9,7 @@ declare module '../../index' { env: { [key: string]: string | undefined /** 框架 */ - FRAMEWORK: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3' + FRAMEWORK: 'react' | 'preact' | 'solid' | 'vue3' /** Taro 环境变量 */ TARO_ENV: 'weapp' | 'h5' | 'rn' | 'swan' | 'alipay' | 'tt' | 'qq' | 'jd' | 'quickapp' /** 文件系统中的用户目录路径 (本地路径) */ diff --git a/packages/taro/types/api/base/system.d.ts b/packages/taro/types/api/base/system.d.ts index 09bd8430117f..3e20b53b49f8 100644 --- a/packages/taro/types/api/base/system.d.ts +++ b/packages/taro/types/api/base/system.d.ts @@ -546,7 +546,7 @@ declare module '../../index' { getSystemSetting(): getSystemSetting.Result /** [Taro.getSystemInfo](./getSystemInfo) 的同步版本 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion * @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。 * @example @@ -591,7 +591,7 @@ declare module '../../index' { getSystemInfoAsync(res?: getSystemInfoAsync.Option): Promise /** 获取系统信息,支持 `Promise` 化使用。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion * @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。 * @example diff --git a/packages/taro/types/api/base/weapp/app-event.d.ts b/packages/taro/types/api/base/weapp/app-event.d.ts index 9613b3c9c72d..b67bd4bfca12 100644 --- a/packages/taro/types/api/base/weapp/app-event.d.ts +++ b/packages/taro/types/api/base/weapp/app-event.d.ts @@ -113,7 +113,7 @@ declare module '../../../index' { * * **注意** * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。 - * @supported weapp, tt, h5, harmony_hybrid + * @supported weapp, tt, h5, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html */ onUnhandledRejection(callback: onUnhandledRejection.Callback): void @@ -137,7 +137,7 @@ declare module '../../../index' { onPageNotFound(callback: onPageNotFound.Callback): void /** 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。 - * @supported weapp, tt, h5, harmony_hybrid + * @supported weapp, tt, h5, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html */ onError(callback: onError.Callback): void @@ -196,7 +196,7 @@ declare module '../../../index' { ): void /** 取消监听未处理的 Promise 拒绝事件 - * @supported weapp, tt, h5, harmony_hybrid + * @supported weapp, tt, h5, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html */ offUnhandledRejection(callback: onUnhandledRejection.Callback): void @@ -217,7 +217,7 @@ declare module '../../../index' { ): void /** 取消监听音频播放错误事件 - * @supported weapp, tt, h5, harmony_hybrid + * @supported weapp, tt, h5, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html */ diff --git a/packages/taro/types/api/device/accelerometer.d.ts b/packages/taro/types/api/device/accelerometer.d.ts index 02cf4b7a0e2c..3d5e8bbba23f 100644 --- a/packages/taro/types/api/device/accelerometer.d.ts +++ b/packages/taro/types/api/device/accelerometer.d.ts @@ -56,7 +56,7 @@ declare module '../../index' { * ```tsx * Taro.startAccelerometer({ interval: 'game' }) * ``` - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html */ startAccelerometer (res?: startAccelerometer.Option): Promise @@ -67,14 +67,14 @@ declare module '../../index' { * ```tsx * Taro.stopAccelerometer() * ``` - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html */ stopAccelerometer (res?: stopAccelerometer.Option): Promise /** * 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 `Taro.stopAccelerometer` 停止监听。 - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony * @example * ```tsx * Taro.onAccelerometerChange(res => { @@ -91,7 +91,7 @@ declare module '../../index' { /** * 取消监听加速度数据事件,参数为空,则取消所有的事件监听。 - * @supported weapp, alipay, swan, jd, tt, h5, rn + * @supported weapp, alipay, swan, jd, tt, h5, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html */ offAccelerometerChange( diff --git a/packages/taro/types/api/device/battery.d.ts b/packages/taro/types/api/device/battery.d.ts index 58baf1180378..516bd4695435 100644 --- a/packages/taro/types/api/device/battery.d.ts +++ b/packages/taro/types/api/device/battery.d.ts @@ -32,13 +32,13 @@ declare module '../../index' { interface TaroStatic { /** Taro.getBatteryInfo 的同步版本 - * @supported weapp, alipay, swan, jd, qq + * @supported weapp, alipay, swan, jd, qq, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html */ getBatteryInfoSync(): getBatteryInfoSync.Result /** 获取设备电量。同步 API Taro.getBatteryInfoSync 在 iOS 上不可用。 - * @supported weapp, alipay, swan, jd, qq, h5, harmony_hybrid + * @supported weapp, alipay, swan, jd, qq, h5, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html */ getBatteryInfo(option?: getBatteryInfo.Option): Promise diff --git a/packages/taro/types/api/device/clipboard.d.ts b/packages/taro/types/api/device/clipboard.d.ts index 6294af99e554..37d3bf314e05 100644 --- a/packages/taro/types/api/device/clipboard.d.ts +++ b/packages/taro/types/api/device/clipboard.d.ts @@ -43,7 +43,7 @@ declare module '../../index' { interface TaroStatic { /** 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s - * @supported weapp, swan, jd, qq, h5, rn, tt, harmony_hybrid + * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid * @h5 部分实现 * @example * ```tsx @@ -63,19 +63,19 @@ declare module '../../index' { setClipboardData(option: setClipboardData.Option): Promise /** - * 获取系统剪贴板内容 - * @supported weapp, swan, jd, qq, h5, rn, tt, harmony_hybrid - * @h5 部分实现 - * @example - * ```tsx - * Taro.getClipboardData({ - * success: function (res){ - * console.log(res.data) - * } - * }) - * ``` - * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html - */ + * 获取系统剪贴板内容 + * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid + * @h5 部分实现 + * @example + * ```tsx + * Taro.getClipboardData({ + * success: function (res){ + * console.log(res.data) + * } + * }) + * ``` + * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html + */ getClipboardData(res?: getClipboardData.Option): Promise } } diff --git a/packages/taro/types/api/device/keyboard.d.ts b/packages/taro/types/api/device/keyboard.d.ts index a49f6830adfc..bf6f1bbae5f9 100644 --- a/packages/taro/types/api/device/keyboard.d.ts +++ b/packages/taro/types/api/device/keyboard.d.ts @@ -71,7 +71,7 @@ declare module '../../index' { getSelectedTextRange(option?: getSelectedTextRange.Option): Promise /** 监听键盘高度变化 - * @supported weapp, swan, jd, qq, rn + * @supported weapp, swan, jd, qq, rn, harmony * @example * ```tsx * Taro.onKeyboardHeightChange(res => { @@ -86,7 +86,7 @@ declare module '../../index' { /** * 取消监听键盘高度变化事件。 - * @supported weapp, swan, jd, rn + * @supported weapp, swan, jd, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html */ offKeyboardHeightChange( diff --git a/packages/taro/types/api/device/network.d.ts b/packages/taro/types/api/device/network.d.ts index 82fa43b82583..7864bba8bc52 100644 --- a/packages/taro/types/api/device/network.d.ts +++ b/packages/taro/types/api/device/network.d.ts @@ -107,7 +107,7 @@ declare module '../../index' { ): void /** 监听网络状态变化。 - * @supported weapp, swan, h5, rn, tt, harmony_hybrid + * @supported weapp, swan, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.onNetworkStatusChange(function (res) { @@ -132,7 +132,7 @@ declare module '../../index' { ): void /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。 - * @supported weapp, swan, h5, rn, harmony_hybrid + * @supported weapp, swan, h5, rn, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html */ offNetworkStatusChange( @@ -141,7 +141,7 @@ declare module '../../index' { ): void /** 获取网络类型。 - * @supported weapp, swan, qq, h5, rn, tt, harmony_hybrid + * @supported weapp, swan, qq, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.getNetworkType({ diff --git a/packages/taro/types/api/device/phone.d.ts b/packages/taro/types/api/device/phone.d.ts index 72e268820c1e..a7062e35dda0 100644 --- a/packages/taro/types/api/device/phone.d.ts +++ b/packages/taro/types/api/device/phone.d.ts @@ -16,7 +16,7 @@ declare module '../../index' { interface TaroStatic { /** 拨打电话 - * @supported weapp, swan, jd, qq, tt, h5, rn, harmony_hybrid + * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.makePhoneCall({ diff --git a/packages/taro/types/api/device/screen.d.ts b/packages/taro/types/api/device/screen.d.ts index 4851daaa0137..6f539167aba3 100644 --- a/packages/taro/types/api/device/screen.d.ts +++ b/packages/taro/types/api/device/screen.d.ts @@ -179,7 +179,7 @@ declare module '../../index' { /** 取消用户录屏事件的监听函数 * @supported weapp - * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html + * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html */ offScreenRecordingStateChanged( /** 用户录屏事件的监听函数 */ @@ -207,7 +207,7 @@ declare module '../../index' { * * **说明** * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。 - * @supported weapp, alipay, swan, jd, qq, rn + * @supported weapp, alipay, swan, jd, qq, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html */ getScreenBrightness( diff --git a/packages/taro/types/api/device/vibrate.d.ts b/packages/taro/types/api/device/vibrate.d.ts index 7e3838b5d3de..9acbd72220ac 100644 --- a/packages/taro/types/api/device/vibrate.d.ts +++ b/packages/taro/types/api/device/vibrate.d.ts @@ -29,7 +29,7 @@ declare module '../../index' { /** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效 * * 仅微信小程序平台支持 type 参数 - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony * @example * ```tsx * Taro.vibrateShort(params).then(...) @@ -39,7 +39,7 @@ declare module '../../index' { vibrateShort(option?: vibrateShort.Option): Promise /** 使手机发生较长时间的振动(400ms) - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony * @example * ```tsx * Taro.vibrateLong(params).then(...) diff --git a/packages/taro/types/api/media/image.d.ts b/packages/taro/types/api/media/image.d.ts index 8648583e25c0..fe0f4b240403 100644 --- a/packages/taro/types/api/media/image.d.ts +++ b/packages/taro/types/api/media/image.d.ts @@ -19,7 +19,7 @@ declare module '../../index' { /** 需要预览的图片链接列表。 */ urls: string[] /** - * 微信端为当前显示图片的链接,支付宝端为当前显示图片的索引值 + * 当前显示图片的http链接 */ current?: string | number /** @@ -221,7 +221,7 @@ declare module '../../index' { /** 压缩后图片的宽度,单位为px,若不填写则默认以 compressedHeight 为准等比缩放。 */ compressedWidth?: number /** 压缩后图片的高度,单位为px,若不填写则默认以 compressedWidth 为准等比缩放。 */ - compressHeight?: number + compressedHeight?: number /** 接口调用成功的回调函数 */ success?: (result: SuccessCallbackResult) => void } @@ -361,7 +361,7 @@ declare module '../../index' { previewImage(option: previewImage.Option): Promise /** 获取图片信息。网络图片需先配置download域名才能生效。 - * @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.getImageInfo({ diff --git a/packages/taro/types/api/network/request.d.ts b/packages/taro/types/api/network/request.d.ts index 416a73fba41c..4fac0617ef1a 100644 --- a/packages/taro/types/api/network/request.d.ts +++ b/packages/taro/types/api/network/request.d.ts @@ -78,7 +78,7 @@ declare module '../../index' { /** 接口调用失败的回调函数 */ fail?: (res: TaroGeneral.CallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: (res: TaroGeneral.CallbackResult) => void + complete?: (res: Partial & TaroGeneral.CallbackResult) => void /** 设置是否使用 jsonp 方式获取数据 * @default false * @supported h5 @@ -400,7 +400,7 @@ declare module '../../index' { * - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`) * - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化 * - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)` - * @supported weapp, h5, rn, alipay, swan, tt, qq, harmony_hybrid + * @supported weapp, h5, rn, alipay, swan, tt, qq, harmony, harmony_hybrid * @example * ```tsx * Taro.request({ diff --git a/packages/taro/types/api/route/index.d.ts b/packages/taro/types/api/route/index.d.ts index 5d908282c434..8bc89d4b8b42 100644 --- a/packages/taro/types/api/route/index.d.ts +++ b/packages/taro/types/api/route/index.d.ts @@ -44,10 +44,16 @@ declare module '../../index' { interface Option { /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ url: string - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: (res: TaroGeneral.CallbackResult) => void /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。 */ events?: TaroGeneral.IAnyObject + /** 2.29.2 自定义路由类型 */ + routeType?: string + /** 3.4.0 自定义路由配置 */ + routeConfig?: TaroGeneral.IAnyObject + /** 3.4.0 自定义路由参数 */ + routeOptions?: TaroGeneral.IAnyObject + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: (res: TaroGeneral.CallbackResult) => void /** 接口调用失败的回调函数 */ fail?: (res: TaroGeneral.CallbackResult) => void /** 接口调用成功的回调函数 */ @@ -115,9 +121,106 @@ declare module '../../index' { ): void } + namespace router { + type CustomRouteBuilder = (routeContext: CustomRouteContext, routeOptions: Record) => CustomRouteConfig + + interface SharedValue { + value: T + } + + interface CustomRouteContext { + // 动画控制器,影响推入页面的进入和退出过渡效果 + primaryAnimation: SharedValue + // 动画控制器状态 + primaryAnimationStatus: SharedValue + // 动画控制器,影响栈顶页面的推出过渡效果 + secondaryAnimation: SharedValue + // 动画控制器状态 + secondaryAnimationStatus: SharedValue + // 当前路由进度由手势控制 + userGestureInProgress: SharedValue + // 手势开始控制路由 + startUserGesture: () => void + // 手势不再控制路由 + stopUserGesture: () => void + // 返回上一级,效果同 wx.navigateBack + didPop: () => void + } + + interface CustomRouteConfig { + // 下一个页面推入后,不显示前一个页面 + opaque?: boolean + // 是否保持前一个页面状态 + maintainState?: boolean + // 页面推入动画时长,单位 ms + transitionDuration?: number + // 页面推出动画时长,单位 ms + reverseTransitionDuration?: number + // 遮罩层背景色,支持 rgba() 和 #RRGGBBAA 写法 + barrierColor?: string + // 点击遮罩层返回上一页 + barrierDismissible?: boolean + // 无障碍语义 + barrierLabel?: string + // 是否与下一个页面联动,决定当前页 secondaryAnimation 是否生效 + canTransitionTo?: boolean + // 是否与前一个页面联动,决定前一个页 secondaryAnimation 是否生效 + canTransitionFrom?: boolean + // 处理当前页的进入/退出动画,返回 StyleObject + handlePrimaryAnimation?: RouteAnimationHandler + // 处理当前页的压入/压出动画,返回 StyleObject + handleSecondaryAnimation?: RouteAnimationHandler + // 处理上一级页面的压入/压出动画,返回 StyleObject 基础库 <3.0.0> 起支持 + handlePreviousPageAnimation?: RouteAnimationHandler + // 页面进入时是否采用 snapshot 模式优化动画性能 基础库 <3.2.0> 起支持 + allowEnterRouteSnapshotting?: boolean + // 页面退出时是否采用 snapshot 模式优化动画性能 基础库 <3.2.0> 起支持 + allowExitRouteSnapshotting?: boolean + // 右滑返回时,可拖动范围是否撑满屏幕,基础库 <3.2.0> 起支持,常用于半屏弹窗 + fullscreenDrag?: boolean + // 返回手势方向 基础库 <3.4.0> 起支持 + popGestureDirection?: 'horizontal' | 'vertical' | 'multi' + } + + type RouteAnimationHandler = () => { [key: string] : any} + + /** 自定义路由 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/wx.router.html + */ + interface router { + /** 添加自定义路由配置 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.addRouteBuilder.html + */ + addRouteBuilder( + /** 路由类型 */ + routeType: string, + /** 路由动画定义函数 */ + routeBuilder: CustomRouteBuilder + ): void + /** 获取页面对应的自定义路由上下文对象 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.getRouteContext.html + */ + getRouteContext( + /** 页面/自定义组件实例 */ + instance: TaroGeneral.IAnyObject + ): CustomRouteContext + /** 移除自定义路由配置 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.removeRouteBuilder.html + */ + removeRouteBuilder( + /** 路由类型 */ + routeType: string, + ): void + } + } + interface TaroStatic { /** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```json * { @@ -143,7 +246,7 @@ declare module '../../index' { switchTab(option: switchTab.Option): Promise /** 关闭所有页面,打开到应用内的某个页面 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.reLaunch({ @@ -155,7 +258,7 @@ declare module '../../index' { reLaunch(option: reLaunch.Option): Promise /** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @h5 未针对 tabbar 页面做限制处理 * @example * ```tsx @@ -168,7 +271,7 @@ declare module '../../index' { redirectTo(option: redirectTo.Option): Promise /** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @h5 未针对 tabbar 页面做限制处理 * @example * ```tsx @@ -195,7 +298,7 @@ declare module '../../index' { navigateTo(option: navigateTo.Option): Promise /** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @h5 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。 * @example * ```tsx @@ -216,5 +319,6 @@ declare module '../../index' { * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html */ navigateBack(option?: navigateBack.Option): Promise + router: router.router } } diff --git a/packages/taro/types/api/skyline/index.d.ts b/packages/taro/types/api/skyline/index.d.ts index d6a5700e6d76..447c50a2d26e 100644 --- a/packages/taro/types/api/skyline/index.d.ts +++ b/packages/taro/types/api/skyline/index.d.ts @@ -56,4 +56,290 @@ declare module '../../index' { } } } + + /** + * DraggableSheet 实例,可通过 Taro.createSelectorQuery 的 NodesRef.node 方法获取。 + * + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.html + */ + interface DraggableSheetContext { + /** + * 滚动到指定位置。size 取值 [0, 1],size = 1 时表示撑满 draggable-sheet 组件。size 和 pixels 同时传入时,仅 size 生效。 + * @param option + * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.scrollTo.html + */ + scrollTo(option: DraggableSheetContext.scrollTo.Option): void + } + + namespace DraggableSheetContext { + namespace scrollTo { + interface Option { + /** 相对目标位置 */ + size?: number + /** 绝对目标位置 */ + pixels?: number + /** + * 是否启用滚动动画 + * @default true + */ + animated?: boolean + /** + * 滚动动画时长(ms) + * @default 300 + */ + duration?: number + /** + * 缓动函数 + * @default ease + */ + easingFunction?: string + } + } + } + + /** + * worklet 对象,可以通过 wx.worklet 获取 + * + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html + */ + interface worklet { + /** + * 取消由 SharedValue 驱动的动画 + * @param SharedValue + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html + */ + cancelAnimation(SharedValue: worklet.SharedValue): void + /** + * 衍生值 DerivedValue,可基于已有的 SharedValue 生成其它共享变量。 + * @param updaterWorklet + * @returns 返回 DerivedValue 类型值,可被 worklet 函数捕获。DerivedValue 也是 SharedValue 类型。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html + */ + derived(updaterWorklet: worklet.WorkletFunction): worklet.DerivedValue + /** + * ScrollView 实例,可在 worklet 函数内操作 scroll-view 组件。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.html + */ + scrollViewContext: { + /** + * 滚动至指定位置 + * @param object + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.scrollTo.html + */ + scrollTo(NodesRef: TaroGeneral.IAnyObject, object: worklet.scrollViewContext.Option): void + } + /** + * 创建共享变量 SharedValue,用于跨线程共享数据和驱动动画。 + * @param initialValue + * @returns 返回 SharedValue 类型值,可被 worklet 函数捕获。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html + */ + shared(initialValue: number | string | bool | null | undefined | Object | Array | Function): worklet.SharedValue + /** + * 基于滚动衰减的动画。 + * @param options 动画配置 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html + */ + decay(options?: worklet.decay.Option, callback?: (flag: boolean) => void): worklet.AnimationObject + Easing: worklet.Easing + /** + * 基于物理的动画。 + * @param toValue 目标值 + * @param options 动画配置 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html + */ + spring(toValue: number | string, options?: worklet.spring.Option, callback?: (flag: boolean) => void): worklet.AnimationObject + /** + * 基于时间的动画。 + * @param toValue 目标值 + * @param options 动画配置 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html + */ + timing(toValue: number | string, options?: worklet.timing.Option, callback?: (flag: boolean) => void): worklet.AnimationObject + /** + * 延迟执行动画。 + * @param delayMS 动画开始前等待的时间,单位:毫秒 + * @param delayedAnimation 动画对象 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html + */ + delay(delayMS: number, delayedAnimation: worklet.AnimationObject): worklet.AnimationObject + /** + * 重复执行动画。 + * @param animation 动画对象 + * @param numberOfReps 重复次数。为负值时一直循环,直到被取消动画。 + * @param reverse 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html + */ + repeat(delayedAnimation: worklet.AnimationObject, numberOfReps: number, reverse?: boolean, callback?: (flag: boolean) => void): worklet.AnimationObject + /** + * 组合动画序列,依次执行传入的动画。 + * @param animation 动画对象 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html + */ + sequence(...delayedAnimation: worklet.AnimationObject): worklet.AnimationObject + /** + * worklet 函数运行在 UI 线程时,捕获的外部函数可能为 worklet 类型或普通函数,为了更明显的对其区分,要求必须使用 runOnJS 调回 JS 线程的普通函数。 有这样的要求是因为,调用其它 worklet 函数时是同步调用,但在 UI 线程执行 JS 线程的函数只能是异步,开发者容易混淆,试图同步获取 JS 线程的返回值。 + * @param fn worklet 类型函数 + * @returns runOnJS 为高阶函数,返回一个函数,执行时运行在 JS 线程 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html + */ + runOnJS(fn: TaroGeneral.TFunc): TaroGeneral.TFunc + /** + * 在 UI 线程执行 worklet 函数 + * @param fn worklet 类型函数 + * @returns runOnUI 为高阶函数,返回一个函数,执行时运行在 UI 线程 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html + */ + runOnUI(fn: TaroGeneral.TFunc): TaroGeneral.TFunc + } + + namespace worklet { + type SharedValue = TaroGeneral.IAnyObject + type DerivedValue = worklet.SharedValue + type AnimationObject = TaroGeneral.IAnyObject + type WorkletFunction = TaroGeneral.TFunc + + namespace scrollViewContext { + interface Option { + /** 顶部距离 */ + top?: number + /** 左边界距离 */ + left?: number + /** 滚动动画时长 */ + duration?: number + /** 是否启用滚动动画 */ + animated?: boolean + /** 动画曲线 */ + easingFunction?: string + } + } + + namespace decay { + interface Option { + /** 初速度 */ + velocity?: number + /** 衰减速率 */ + deceleration?: number + /** 边界值,长度为 2 的数组 */ + clamp?: Array + } + } + + interface Easing { + /** + * 简单的反弹效果 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + bounce(t: number): any; + /** + * 简单的惯性动画 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + ease(t: number): any; + /** + * 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + elastic(bounciness?: number): any; + /** + * 线性函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + linear(t: number): any; + /** + * 二次方函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + quad(t: number): any; + /** + * 立方函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + cubic(t: number): any; + /** + * 高阶函数,返回幂函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + poly(n: number): any; + /** + * 三次贝塞尔曲线,效果同 css transition-timing-function + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + bezier(x1: number, y1: number, x2: number, y2: number): any; + /** + * 圆形曲线 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + circle(t: number): any; + /** + * 正弦函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + sin(t: number): any; + /** + * 指数函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + exp(t: number): any; + /** + * 正向运行 easing function,高阶函数。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + in(easing: (t: number) => any): any; + /** + * 反向运行 easing function,高阶函数。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + out(easing: (t: number) => any): any; + /** + * 前半程正向,后半程反向,高阶函数。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + inOut(easing: (t: number) => any): any; + } + + namespace spring { + interface Option { + /** 阻尼系数 */ + damping?: number + /** 重量系数,值越大移动越慢 */ + mass?: number + /** 弹性系数 */ + stiffness?: number + /** 动画是否可以在指定值上反弹 */ + overshootClamping?: boolean + /** 弹簧静止时的位移 */ + restDisplacementThreshold?: number + /** 弹簧静止的速度 */ + restSpeedThreshold?: number + /** 速度 */ + velocity?: number + } + } + + namespace timing { + interface Option { + /** 动画时长 */ + duration?: number + /** 动画曲线 */ + easing?: (t: number) => number + } + } + } + + interface TaroStatic { + worklet: worklet + } } diff --git a/packages/taro/types/api/storage/index.d.ts b/packages/taro/types/api/storage/index.d.ts index 7d7389b46fa6..120b4227e090 100644 --- a/packages/taro/types/api/storage/index.d.ts +++ b/packages/taro/types/api/storage/index.d.ts @@ -177,7 +177,7 @@ declare module '../../index' { ): void /** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。 - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.setStorage({ @@ -221,7 +221,7 @@ declare module '../../index' { ): void /** 从本地缓存中移除指定 key - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.removeStorage({ @@ -289,7 +289,7 @@ declare module '../../index' { getStorageInfo(option?: getStorageInfo.Option): Promise /** 从本地缓存中异步获取指定 key 的内容 - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.getStorage({ @@ -327,7 +327,7 @@ declare module '../../index' { clearStorageSync(): void /** 清理本地数据缓存 - * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid + * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.clearStorage() diff --git a/packages/taro/types/api/swan/pay.d.ts b/packages/taro/types/api/swan/pay.d.ts index 1ebbc2f25164..8c4611c91453 100644 --- a/packages/taro/types/api/swan/pay.d.ts +++ b/packages/taro/types/api/swan/pay.d.ts @@ -1,4 +1,4 @@ -import { Interface } from 'readline' +import { Interface } from 'node:readline' import Taro from '../../index' declare module '../../index' { @@ -117,12 +117,12 @@ declare module '../../index' { } interface TaroStatic { - /** + /** * 1)百度收银台,聚合了主流的百度钱包、微信、支付宝、网银等多种支付渠道,方便开发者一站式快速接入多种支付渠道,让百度用户能在智能小程序场景下,直接完成支付、交易闭环,提升用户支付体验的同时,提高智能小程序的订单转化率。 * 2)上述支付渠道在 C 端收银台有两种展示方式,开发者可以选择其中一种实现。 * 方式一:将支付渠道内嵌在小程序提单页面中,实现方式参考文档[inline-payment-panel内嵌支付组件](https://smartprogram.baidu.com/docs/develop/component/inline_payment_panel/)。 * 方式二:在用户确认订单后,调起收银台半屏面板承载支付渠道,实现方式参考文档调起[百度收银台](https://smartprogram.baidu.com/docs/develop/function/tune_up_2.0/#%E7%99%BE%E5%BA%A6%E6%94%B6%E9%93%B6%E5%8F%B0%E6%8E%A5%E5%8F%A32-0-%E8%AF%B4%E6%98%8E)。 - * + * * Web 态说明:为了保证用户交易行为全流程闭环体验,在 Web 态下调用该方法会做打开百度 App 对应小程序页面的降级处理。 * @supported swan * @see https://smartprogram.baidu.com/docs/develop/api/open/payment_swan-requestPolymerPayment/ @@ -136,4 +136,4 @@ declare module '../../index' { */ getOptimalPriceInfo(option: getOptimalPriceInfo.Option): void } -} \ No newline at end of file +} diff --git a/packages/taro/types/api/taro.extend.d.ts b/packages/taro/types/api/taro.extend.d.ts index 9a948e318d7a..4519a77168a8 100644 --- a/packages/taro/types/api/taro.extend.d.ts +++ b/packages/taro/types/api/taro.extend.d.ts @@ -38,13 +38,15 @@ declare module '../index' { /** @ignore */ interface TARO_ENV_TYPE { [TaroGeneral.ENV_TYPE.WEAPP]: TaroGeneral.ENV_TYPE.WEAPP - [TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB - [TaroGeneral.ENV_TYPE.RN]: TaroGeneral.ENV_TYPE.RN [TaroGeneral.ENV_TYPE.SWAN]: TaroGeneral.ENV_TYPE.SWAN [TaroGeneral.ENV_TYPE.ALIPAY]: TaroGeneral.ENV_TYPE.ALIPAY [TaroGeneral.ENV_TYPE.TT]: TaroGeneral.ENV_TYPE.TT [TaroGeneral.ENV_TYPE.QQ]: TaroGeneral.ENV_TYPE.QQ [TaroGeneral.ENV_TYPE.JD]: TaroGeneral.ENV_TYPE.JD + [TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB + [TaroGeneral.ENV_TYPE.RN]: TaroGeneral.ENV_TYPE.RN + [TaroGeneral.ENV_TYPE.HARMONY]: TaroGeneral.ENV_TYPE.HARMONY + [TaroGeneral.ENV_TYPE.QUICKAPP]: TaroGeneral.ENV_TYPE.QUICKAPP [TaroGeneral.ENV_TYPE.HARMONYHYBRID]: TaroGeneral.ENV_TYPE.HARMONYHYBRID } @@ -98,7 +100,7 @@ declare module '../index' { }): void /** 小程序获取和 Taro 相关的 App 信息 - * @supported weapp, alipay, jd, qq, swan, tt, h5, harmony_hybrid + * @supported weapp, alipay, jd, qq, swan, tt, h5, harmony, harmony_hybrid */ getAppInfo(): getAppInfo.AppInfo diff --git a/packages/taro/types/api/ui/animation.d.ts b/packages/taro/types/api/ui/animation.d.ts index d527889114b6..5339ffd7bef4 100644 --- a/packages/taro/types/api/ui/animation.d.ts +++ b/packages/taro/types/api/ui/animation.d.ts @@ -410,7 +410,7 @@ declare module '../../index' { interface TaroStatic { /** 创建一个动画实例 [animation](../Animation)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 - * @supported weapp, h5, tt, harmony_hybrid + * @supported weapp, tt, h5, harmony, harmony_hybrid * @example * ```tsx * var animation = Taro.createAnimation({ diff --git a/packages/taro/types/api/ui/interaction.d.ts b/packages/taro/types/api/ui/interaction.d.ts index e14e9b19b9db..d5682a10554f 100644 --- a/packages/taro/types/api/ui/interaction.d.ts +++ b/packages/taro/types/api/ui/interaction.d.ts @@ -160,7 +160,7 @@ declare module '../../index' { * **注意** * - Taro.showLoading 和 Taro.showToast 同时只能显示一个 * - Taro.showToast 应与 Taro.hideToast 配对使用 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.showToast({ @@ -177,7 +177,7 @@ declare module '../../index' { * **注意** * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 - * @supported weapp, swan, h5, rn, tt, harmony_hybrid + * @supported weapp, swan, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.showModal({ @@ -220,7 +220,7 @@ declare module '../../index' { * **注意** * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.showActionSheet({ diff --git a/packages/taro/types/api/ui/navigation-bar.d.ts b/packages/taro/types/api/ui/navigation-bar.d.ts index 8da578bc504d..d978a3fe2642 100644 --- a/packages/taro/types/api/ui/navigation-bar.d.ts +++ b/packages/taro/types/api/ui/navigation-bar.d.ts @@ -79,13 +79,13 @@ declare module '../../index' { interface TaroStatic { /** 在当前页面显示导航条加载动画 - * @supported weapp, rn, tt + * @supported weapp, rn, tt, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html */ showNavigationBarLoading(option?: showNavigationBarLoading.Option): void /** 动态设置当前页面的标题 - * @supported weapp, alipay, h5, rn, tt, harmony_hybrid + * @supported weapp, alipay, tt, h5, rn, harmony, harmony_hybrid * @example * ```tsx * Taro.setNavigationBarTitle({ @@ -97,7 +97,7 @@ declare module '../../index' { setNavigationBarTitle(option: setNavigationBarTitle.Option): Promise /** 设置页面导航条颜色 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, tt, h5, rn, harmony, harmony_hybrid * @h5 不支持 animation 参数 * @rn 不支持 animation 参数 * @example @@ -116,13 +116,13 @@ declare module '../../index' { setNavigationBarColor(option: setNavigationBarColor.Option): Promise /** 在当前页面隐藏导航条加载动画 - * @supported weapp, rn, tt + * @supported weapp, rn, tt, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html */ hideNavigationBarLoading(option?: hideNavigationBarLoading.Option): void /** 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。 - * @supported weapp, tt + * @supported weapp, tt, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html */ hideHomeButton(option?: hideHomeButton.Option): Promise diff --git a/packages/taro/types/api/ui/pull-down-refresh.d.ts b/packages/taro/types/api/ui/pull-down-refresh.d.ts index 129b9985faf5..ed28fd8a551d 100644 --- a/packages/taro/types/api/ui/pull-down-refresh.d.ts +++ b/packages/taro/types/api/ui/pull-down-refresh.d.ts @@ -25,7 +25,7 @@ declare module '../../index' { interface TaroStatic { /** 停止当前页面下拉刷新。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * onPullDownRefresh: function (){ @@ -37,7 +37,7 @@ declare module '../../index' { stopPullDownRefresh(option?: stopPullDownRefresh.Option): void /** 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @rn 无动画效果 * @example * ```tsx diff --git a/packages/taro/types/api/ui/scroll.d.ts b/packages/taro/types/api/ui/scroll.d.ts index 3153696825cb..cbc7ae854972 100644 --- a/packages/taro/types/api/ui/scroll.d.ts +++ b/packages/taro/types/api/ui/scroll.d.ts @@ -99,7 +99,7 @@ declare module '../../index' { * - 后代选择器:.the-ancestor .the-descendant * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant * - 多选择器的并集:#a-node, .some-other-nodes - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.pageScrollTo({ diff --git a/packages/taro/types/api/ui/tab-bar.d.ts b/packages/taro/types/api/ui/tab-bar.d.ts index afca2e227aa8..57e3be1292b6 100644 --- a/packages/taro/types/api/ui/tab-bar.d.ts +++ b/packages/taro/types/api/ui/tab-bar.d.ts @@ -121,13 +121,13 @@ declare module '../../index' { interface TaroStatic { /** 显示 tabBar 某一项的右上角的红点 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html */ showTabBarRedDot(option: showTabBarRedDot.Option): Promise /** 显示 tabBar - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html */ showTabBar(option?: showTabBar.Option): Promise @@ -148,7 +148,7 @@ declare module '../../index' { setTabBarStyle(option?: setTabBarStyle.Option): Promise /** 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.setTabBarItem({ @@ -163,7 +163,7 @@ declare module '../../index' { setTabBarItem(option: setTabBarItem.Option): Promise /** 为 tabBar 某一项的右上角添加文本 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @example * ```tsx * Taro.setTabBarBadge({ @@ -176,19 +176,19 @@ declare module '../../index' { setTabBarBadge(option: setTabBarBadge.Option): Promise /** 移除 tabBar 某一项右上角的文本 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html */ removeTabBarBadge(option: removeTabBarBadge.Option): Promise /** 隐藏 tabBar 某一项的右上角的红点 - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html */ hideTabBarRedDot(option: hideTabBarRedDot.Option): Promise /** 隐藏 tabBar - * @supported weapp, h5, rn, tt, harmony_hybrid + * @supported weapp, h5, rn, tt, harmony, harmony_hybrid * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html */ hideTabBar(option?: hideTabBar.Option): Promise diff --git a/packages/taro/types/api/wxml/index.d.ts b/packages/taro/types/api/wxml/index.d.ts index dc033bf72154..79dabc91e51a 100644 --- a/packages/taro/types/api/wxml/index.d.ts +++ b/packages/taro/types/api/wxml/index.d.ts @@ -66,19 +66,25 @@ declare module '../../index' { } namespace IntersectionObserver { - /** 监听相交状态变化的回调函数 */ + /** 监听相交状态变化的回调函数 + * @description Harmony 找不到对应元素时,回调会返回一个 Error 对象 + */ type ObserveCallback = (result: ObserveCallbackResult) => void - interface ObserveCallbackResult { + interface ObserveCallbackResult extends TaroGeneral.CallbackResult { + /** 错误信息,会在找不到对应元素时返回 + * @supported harmony + */ + errMsg?: string /** 目标边界 */ - boundingClientRect: BoundingClientRectResult + boundingClientRect?: BoundingClientRectResult /** 相交比例 */ - intersectionRatio: number + intersectionRatio?: number /** 相交区域的边界 */ - intersectionRect: IntersectionRectResult + intersectionRect?: IntersectionRectResult /** 参照区域的边界 */ - relativeRect: RelativeRectResult + relativeRect?: RelativeRectResult /** 相交检测时的时间戳 */ - time: number + time?: number } /** 参照区域的边界 */ interface RelativeRectResult { @@ -484,7 +490,7 @@ declare module '../../index' { interface TaroStatic { /** 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。 - * @supported weapp, h5, tt, harmony_hybrid + * @supported weapp, h5, tt, harmony, harmony_hybrid * @example * ```tsx * const query = Taro.createSelectorQuery() @@ -500,7 +506,7 @@ declare module '../../index' { createSelectorQuery(): SelectorQuery /** 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。 - * @supported weapp, h5, tt, harmony_hybrid + * @supported weapp, h5, tt, harmony, harmony_hybrid * @example * ```tsx * const observer = Taro.createIntersectionObserver(this, { thresholds: [0], observeAll: true }) diff --git a/packages/taro/types/compile/compiler.d.ts b/packages/taro/types/compile/compiler.d.ts index 148fdc9000fe..8a82fc30175e 100644 --- a/packages/taro/types/compile/compiler.d.ts +++ b/packages/taro/types/compile/compiler.d.ts @@ -1,7 +1,11 @@ import type { swc } from '@tarojs/helper' import type Webpack from 'webpack' -type CompilerTypes = 'webpack4' | 'webpack5' +export type CompilerViteTypes = 'vite' + +export type CompilerWebpackTypes = 'webpack5' + +export type CompilerTypes = CompilerWebpackTypes | CompilerViteTypes interface IPrebundle { enable?: boolean @@ -17,11 +21,12 @@ interface IPrebundle { } } -interface ICompiler { - type: CompilerTypes +interface ICompiler { + type: T prebundle?: IPrebundle + vitePlugins?: any /** 错误处理级别。可选值:0、1 */ errorLevel?: number } -export type Compiler = CompilerTypes | ICompiler +export type Compiler = T | ICompiler diff --git a/packages/taro/types/compile/config/h5.d.ts b/packages/taro/types/compile/config/h5.d.ts index 5aeaec609640..088d4164c5c1 100644 --- a/packages/taro/types/compile/config/h5.d.ts +++ b/packages/taro/types/compile/config/h5.d.ts @@ -2,7 +2,10 @@ import type Webpack from 'webpack' import type Chain from 'webpack-chain' import type webpackDevServer from 'webpack-dev-server' import type HtmlWebpackPlugin from 'html-webpack-plugin' -import type { IOption, IPostcssOption } from './util' +import type { IOption, IPostcssOption, IUrlLoaderOption } from './util' +import type { OutputOptions as RollupOutputOptions } from 'rollup' +import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler' +import type { OutputExt } from './project' export interface IH5RouterConfig { /** 配置路由模式 */ @@ -14,9 +17,11 @@ export interface IH5RouterConfig { lazyload?: boolean | ((pagename: string) => boolean) renamePagename?: (pagename: string) => string forcePath?: string + /** 加上这个参数,可以解决返回页面的时候白屏的问题,但是某些不支持 :has() 选择器的浏览器会有问题 */ + enhanceAnimation?: boolean } -export interface IH5Config { +export interface IH5Config { /** 设置输出解析文件的目录(默认值:'/')*/ publicPath?: string @@ -35,8 +40,12 @@ export interface IH5Config { */ webpackChain?: (chain: Chain, webpack: typeof Webpack) => void - /** 可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/) */ - output?: Webpack.Configuration['output'] + /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/) + * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/) + */ + output?: T extends 'vite' + ? Pick & OutputExt + : Webpack.Configuration['output'] /** 路由相关的配置 */ router?: IH5RouterConfig @@ -82,13 +91,13 @@ export interface IH5Config { stylusLoaderOption?: IOption /** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ - mediaUrlLoaderOption?: IOption + mediaUrlLoaderOption?: IUrlLoaderOption /** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ - fontUrlLoaderOption?: IOption + fontUrlLoaderOption?: IUrlLoaderOption /** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ - imageUrlLoaderOption?: IOption + imageUrlLoaderOption?: IUrlLoaderOption /** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */ miniCssExtractPluginOption?: IOption @@ -103,14 +112,20 @@ export interface IH5Config { useDeprecatedAdapterComponent?: boolean /** 配置 postcss 相关插件 */ - postcss?: IPostcssOption + postcss?: IPostcssOption<'h5'> /** html-webpack-plugin 的具体配置 */ htmlPluginOption?: HtmlWebpackPlugin.Options /** Web 编译过程的相关配置 */ compile?: { - exclude?: any[] - include?: any[] + exclude?: (string | RegExp)[] + include?: (string | RegExp)[] + filter?: (filename: string) => boolean } + /** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */ + legacy?: T extends 'vite' ? boolean : undefined + + /** 使用的编译工具。可选值:webpack5、vite */ + compiler?: Compiler } diff --git a/packages/taro/types/compile/config/harmony.d.ts b/packages/taro/types/compile/config/harmony.d.ts new file mode 100644 index 000000000000..f042e22c576c --- /dev/null +++ b/packages/taro/types/compile/config/harmony.d.ts @@ -0,0 +1,118 @@ +import type { OutputOptions as RollupOutputOptions } from 'rollup' +import type Webpack from 'webpack' +import type Chain from 'webpack-chain' + +import type { IOption, IPostcssOption, IUrlLoaderOption } from './util' +import type { CompilerTypes, CompilerWebpackTypes } from '../compiler' +import type { OutputExt } from './project' + +export interface IHarmonyRouterConfig { + /** 配置自定义路由 */ + customRoutes?: IOption +} + +export interface IHarmonyConfig { + /** Harmony 项目地址 */ + projectPath: string + + /** hap 名 + * @default "entry" + */ + hapName?: string + + /** 应用名称 + * @default "default" + */ + name?: string + + /** oh-package.json 配置 */ + ohPackage?: { + dependencies?: { [name: string]: string } + devDependencies?: { [name: string]: string } + main?: string + [k: string]: any + } + + /** ohpm-cli + * @default "~/Library/Huawei/ohpm/bin/ohpm" + */ + ohpm?: string + + /** 核心依赖前缀 + * @description 用于告诉编译内容如何解析核心依赖,传入时将直接使用依赖前缀,同时不会为工程导入核心依赖 + */ + chorePackagePrefix?: string + + /** 用于告诉 Taro 编译器需要抽取的公共文件 */ + commonChunks?: string[] | ((commonChunks: string[]) => string[]) + + /** Harmony 编译过程的相关配置 */ + compile?: { + exclude?: any[] + include?: any[] + filter?: (filename: string) => boolean + } + + /** 用于配置半编译模式下的选项 */ + compileModeSetting?: { + componentReplace?: { + [key: string]: { + current_init: string + dependency_define: string + } + } + } + + /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */ + enableSourceMap?: boolean + + /** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */ + sourceMapType?: string + + /** 指定 React 框架相关的代码是否使用开发环境(未压缩)代码,默认使用生产环境(压缩后)代码 */ + debugReact?: boolean + + /** + * 自定义 Webpack 配置 + * @param chain [webpackChain](https://github.com/neutrinojs/webpack-chain) 对象 + * @param webpack webpack 实例 + */ + webpackChain?: (chain: Chain, webpack: typeof Webpack) => void + + /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/) + * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/) + */ + output?: T extends 'vite' + ? Pick & OutputExt + : Webpack.Configuration['output'] & OutputExt + + /** 路由相关的配置 */ + router?: IHarmonyRouterConfig + + /** 配置 postcss 相关插件 */ + postcss?: IPostcssOption<'harmony'> + + /** [css-loader](https://github.com/webpack-contrib/css-loader) 的附加配置 */ + cssLoaderOption?: IOption + + /** [sass-loader](https://github.com/webpack-contrib/sass-loader) 的附加配置 */ + sassLoaderOption?: IOption + + /** [less-loader](https://github.com/webpack-contrib/less-loader) 的附加配置 */ + lessLoaderOption?: IOption + + /** [stylus-loader](https://github.com/shama/stylus-loader) 的附加配置 */ + stylusLoaderOption?: IOption + + /** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ + mediaUrlLoaderOption?: IUrlLoaderOption + + /** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ + fontUrlLoaderOption?: IUrlLoaderOption + + /** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ + imageUrlLoaderOption?: IUrlLoaderOption + + /** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */ + miniCssExtractPluginOption?: IOption +} diff --git a/packages/taro/types/compile/config/index.d.ts b/packages/taro/types/compile/config/index.d.ts index 97fb95fc56a9..543da6a95253 100644 --- a/packages/taro/types/compile/config/index.d.ts +++ b/packages/taro/types/compile/config/index.d.ts @@ -1,5 +1,7 @@ export * from './h5' +export * from './harmony' export * from './mini' +export * from './rn' export * from './manifest' export * from './project' diff --git a/packages/taro/types/compile/config/mini.d.ts b/packages/taro/types/compile/config/mini.d.ts index 04c1ff3f8312..4bc69cc634c8 100644 --- a/packages/taro/types/compile/config/mini.d.ts +++ b/packages/taro/types/compile/config/mini.d.ts @@ -1,6 +1,9 @@ import type Webpack from 'webpack' import type Chain from 'webpack-chain' -import type { IOption, IPostcssOption } from './util' +import type { IOption, IPostcssOption, IUrlLoaderOption } from './util' +import type { OutputOptions as RollupOutputOptions } from 'rollup' +import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler' +import type { OutputExt } from './project' interface Runtime { enableInnerHTML?: boolean @@ -12,7 +15,7 @@ interface Runtime { enableMutationObserver?: boolean } -export interface IMiniAppConfig { +export interface IMiniAppConfig { /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */ enableSourceMap?: boolean @@ -40,24 +43,15 @@ export interface IMiniAppConfig { */ webpackChain?: (chain: Chain, webpack: typeof Webpack, PARSE_AST_TYPE: any) => void - /** 可用于修改、拓展 Webpack 的 [output](https://webpack.js.org/configuration/output/) 选项 */ - output?: Webpack.Configuration['output'] & { - /** - * 编译前清空输出目录 - * @since Taro v3.6.9 - * @description - * - 默认清空输出目录,可设置 clean: false 不清空 - * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件 - * - 注意 clean.keep 不支持函数 - */ - clean?: boolean | { - /** 保留指定文件不删除 */ - keep?: Array | string | RegExp - } - } + /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/) + * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/) + */ + output?: T extends 'vite' + ? Pick & OutputExt + : Webpack.Configuration['output'] & OutputExt /** 配置 postcss 相关插件 */ - postcss?: IPostcssOption + postcss?: IPostcssOption<'mini'> /** [css-loader](https://github.com/webpack-contrib/css-loader) 的附加配置 */ cssLoaderOption?: IOption @@ -72,13 +66,13 @@ export interface IMiniAppConfig { stylusLoaderOption?: IOption /** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ - mediaUrlLoaderOption?: IOption + mediaUrlLoaderOption?: IUrlLoaderOption /** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ - fontUrlLoaderOption?: IOption + fontUrlLoaderOption?: IUrlLoaderOption /** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */ - imageUrlLoaderOption?: IOption + imageUrlLoaderOption?: IUrlLoaderOption /** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */ miniCssExtractPluginOption?: IOption @@ -97,16 +91,29 @@ export interface IMiniAppConfig { /** 小程序编译过程的相关配置 */ compile?: { - exclude?: any[] - include?: any[] + exclude?: (string | RegExp)[] + include?: (string | RegExp)[] + filter?: (filename: string) => boolean } /** 插件内部使用 */ runtime?: Runtime + /** 使用的编译工具。可选值:webpack5、vite */ + compiler?: Compiler + /** 体验式功能 */ experimental?: { /** 是否开启编译模式 */ - compileMode?: boolean + compileMode?: boolean | string + /** 模版渲染时是否使用wxs等小程序脚本语言 */ + useXsForTemplate?: boolean + } +} + +export interface IMiniFilesConfig { + [configName: string]: { + content: any + path: string } } diff --git a/packages/taro/types/compile/config/plugin.d.ts b/packages/taro/types/compile/config/plugin.d.ts new file mode 100644 index 000000000000..f8c82c6776d5 --- /dev/null +++ b/packages/taro/types/compile/config/plugin.d.ts @@ -0,0 +1,34 @@ +import type { CustomPluginOptions, ResolvedId, ResolveIdResult } from 'rollup' + +interface IRollupPluginResolveIdOptions { + assertions?: Record + custom?: CustomPluginOptions + isEntry?: boolean + skipSelf?: boolean +} + +export type TRollupResolveMethod = ( + source: string, + importer?: string, + options?: IRollupPluginResolveIdOptions +) => Promise + +export interface ILoaderMeta { + importFrameworkStatement: string + importFrameworkName: string + creator: string + creatorLocation: string + extraImportForWeb: string + execBeforeCreateWebApp: string + frameworkArgs: string + isNeedRawLoader?: boolean + mockAppStatement: string + modifyConfig?: (config: Record, source: string) => void + modifyResolveId?: (res: { + source?: string + importer?: string + options?: IRollupPluginResolveIdOptions + name?: string + resolve: TRollupResolveMethod + }) => Promise | ResolveIdResult +} diff --git a/packages/taro/types/compile/config/project.d.ts b/packages/taro/types/compile/config/project.d.ts index 12ef67dd465f..6905e408cd9b 100644 --- a/packages/taro/types/compile/config/project.d.ts +++ b/packages/taro/types/compile/config/project.d.ts @@ -1,13 +1,14 @@ import type Webpack from 'webpack' import type Chain from 'webpack-chain' -import { type Input } from 'postcss' -import type { Compiler } from '../compiler' +import type { Input } from 'postcss' +import type { AppConfig } from '../../index' +import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler' import type { IModifyChainData } from '../hooks' import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util' import type { IH5Config } from './h5' -import type { IMiniAppConfig } from './mini' -import { IRNConfig } from './rn' -import { AppConfig } from '../..' +import type { IHarmonyConfig } from './harmony' +import type { IMiniAppConfig, IMiniFilesConfig } from './mini' +import type { IRNConfig } from './rn' export type PluginItem = string | [string, T] | [string, () => T | Promise] @@ -115,7 +116,7 @@ export interface IProjectBaseConfig { jsMinimizer?: 'terser' | 'esbuild' /** 配置 CSS 压缩工具 (默认 csso) */ - cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss' + cssMinimizer?: 'csso' | 'esbuild' | 'lightningcss' /** 配置 csso 工具以压缩 CSS 代码 */ csso?: TogglableOptions @@ -139,11 +140,11 @@ export interface IProjectBaseConfig { /** 模板循环次数 */ baseLevel?: number - /** 使用的开发框架。可选值:react、preact、nerv、vue、vue3 */ - framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3' + /** 使用的开发框架。可选值:react、preact、vue3 */ + framework?: 'react' | 'preact' | 'solid' | 'vue3' frameworkExts?: string[] - /** 使用的编译工具。可选值:webpack4、webpack5 */ + /** 使用的编译工具。可选值:webpack5 */ compiler?: Compiler /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */ @@ -185,18 +186,28 @@ export interface IProjectBaseConfig { modifyWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: IModifyChainData) => Promise /** - * 修改编译过程中的页面组件配置 + * 编译中修改 vite 配置 */ - modifyMiniConfigs?: (configMap: any) => Promise + modifyViteConfig?: (viteConfig: any, data: IModifyChainData) => void /** * 修改编译后的结果 */ modifyBuildAssets?: (assets: any, miniPlugin?: any) => Promise + + /** + * 修改编译过程中的页面组件配置 + */ + modifyMiniConfigs?: (configMap: IMiniFilesConfig) => Promise + + /** + * 修改 Taro 编译配置 + */ + modifyRunnerOpts?: (opts: any) => Promise } /** 暴露出来给 config/index 使用的配置类型,参考 https://github.com/NervJS/taro-doctor/blob/main/assets/config_schema.json */ -export interface IProjectConfig { +export interface IProjectConfig { /** 项目名称 */ projectName?: string @@ -266,7 +277,7 @@ export interface IProjectConfig { jsMinimizer?: 'terser' | 'esbuild' /** 配置 CSS 压缩工具 (默认 csso) */ - cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss' + cssMinimizer?: 'csso' | 'esbuild' | 'lightningcss' /** 配置 csso 工具以压缩 CSS 代码 */ csso?: TogglableOptions @@ -285,11 +296,8 @@ export interface IProjectConfig { /** 一个 preset 是一系列 Taro 插件的集合,配置语法同 plugins */ presets?: PluginItem[] - /** 使用的开发框架。可选值:react、preact、nerv、vue、vue3 */ - framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3' - - /** 使用的编译工具。可选值:webpack4、webpack5 */ - compiler?: Compiler + /** 使用的开发框架。可选值:react、preact、solid、vue3、 none */ + framework?: 'react' | 'preact' | 'solid' | 'vue3' | 'none' /** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */ cache?: ICache @@ -297,14 +305,34 @@ export interface IProjectConfig { /** 控制 Taro 编译日志的输出方式 */ logger?: ILogger - /** 专属于小程序的配置 */ - mini?: IMiniAppConfig + /** 使用的编译工具。可选值:webpack5、vite */ + compiler?: Compiler /** 专属于 H5 的配置 */ - h5?: IH5Config + h5?: IH5Config + + /** 专属于小程序的配置 */ + mini?: IMiniAppConfig /** 专属于 RN 的配置 */ rn?: IRNConfig + harmony?: IHarmonyConfig + [key: string]: any } + +export interface OutputExt { + /** + * 编译前清空输出目录 + * @since Taro v3.6.9 + * @description + * - 默认清空输出目录,可设置 clean: false 不清空 + * - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件 + * - 注意 clean.keep 不支持函数 + */ + clean?: boolean | { + /** 保留指定文件不删除 */ + keep?: Array | string | RegExp + } +} diff --git a/packages/taro/types/compile/config/rn.d.ts b/packages/taro/types/compile/config/rn.d.ts index a7a481e261fd..90d16d586272 100644 --- a/packages/taro/types/compile/config/rn.d.ts +++ b/packages/taro/types/compile/config/rn.d.ts @@ -2,6 +2,7 @@ import type Webpack from 'webpack' import type Chain from 'webpack-chain' import type webpackDevServer from 'webpack-dev-server' import type HtmlWebpackPlugin from 'html-webpack-plugin' +import type { RollupOptions } from 'rollup' import type { IOption, IPostcssOption } from './util' export interface IRNConfig { @@ -61,4 +62,24 @@ export interface IRNConfig { /** 设计稿尺寸换算规则 */ deviceRatio?: TaroGeneral.TDeviceRatio + + /** 原生组件编译配置 */ + nativeComponents?: { + /** + * 外部依赖 + */ + external?: Array | ((arr: Array) => Array) + /** + * 设置外部依赖,如果返回 string, 则将该值作为 external, 我们默认将 node_modules 路径下的文件设置为外部依赖 + */ + exteranlResolve?: (importee: string, importer: string) => string + /** + * 组件输出路径,默认值为 'dist' + */ + output?: string + /** + * 修改 Rollup 打包配置 + */ + modifyRollupConfig?: (config: RollupOptions, innerPlugins: { taroResolver: typeof taroResolver, styleTransformer: typeof styleTransformer }) => RollupOptions + } } diff --git a/packages/taro/types/compile/config/util.d.ts b/packages/taro/types/compile/config/util.d.ts index 7729464a10a6..3643c5e58c2b 100644 --- a/packages/taro/types/compile/config/util.d.ts +++ b/packages/taro/types/compile/config/util.d.ts @@ -1,4 +1,5 @@ -import { type Input } from 'postcss' +import type { Input } from 'postcss' +import type { Options as PostcssUrlOption } from 'postcss-url' export type Func = (...args: any[]) => any @@ -9,6 +10,11 @@ export type TogglableOptions = { config?: T } +export interface IUrlLoaderOption extends IOption { + limit?: number | boolean + name?: ((moduleId: string) => string) | string +} + export namespace PostcssOption { export type cssModules = TogglableOptions<{ /** 转换模式,取值为 global/module */ @@ -16,10 +22,7 @@ export namespace PostcssOption { /** 自定义生成的class名称规则 */ generateScopedName: string | ((localName: string, absoluteFilePath: string) => string) }> - export type url = TogglableOptions<{ - limit: number - basePath?: string | string[] - }> + export type url = TogglableOptions } export interface IHtmlTransformOption { @@ -72,18 +75,29 @@ export interface IPxTransformOption { designWidth?: number | ((size?: string | number | Input) => number) /** 设计稿尺寸换算规则 */ deviceRatio?: TaroGeneral.TDeviceRatio + /** 平台 */ + platform?: 'weapp' | 'h5' | string + /** 启用的能力 Scope 默认为 ['platform', 'size'] */ + methods?: string[] + /** filter 回调函数,可 exclude 不处理的文件 */ + exclude?: (fileName: string) => boolean } -export interface IPostcssOption { +interface IBasePostcssOption { autoprefixer?: TogglableOptions pxtransform?: TogglableOptions cssModules?: PostcssOption.cssModules - url?: PostcssOption.url /** 插件 postcss-html-transform 相关配置, 一般启用了 @tarojs/plugin-html 插件才配置 */ htmltransform?: IHtmlTransformOption [key: string]: any } +export type IPostcssOption = T extends 'h5' + ? IBasePostcssOption & { url?: PostcssOption.url } + : IBasePostcssOption + +export type Config = ViteConfig | WebpackConfig + export interface ICopyOptions { patterns: { from: string diff --git a/packages/taro/types/compile/index.d.ts b/packages/taro/types/compile/index.d.ts index 8d887a2d88bc..8310943aace3 100644 --- a/packages/taro/types/compile/index.d.ts +++ b/packages/taro/types/compile/index.d.ts @@ -1,3 +1,11 @@ export { Current } from '@tarojs/runtime' +export interface IFileType { + style: string + script: string + templ: string + config: string + xs?: string +} + export * from './config' diff --git a/packages/taro/types/compile/viteCompilerContext.d.ts b/packages/taro/types/compile/viteCompilerContext.d.ts new file mode 100644 index 000000000000..48f11ede8203 --- /dev/null +++ b/packages/taro/types/compile/viteCompilerContext.d.ts @@ -0,0 +1,159 @@ +import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template' + +import type { PluginContext } from 'rollup' +import type { IMiniFilesConfig, IH5Config, IHarmonyConfig, IMiniAppConfig } from './config' +import type { IProjectConfig } from './config/project' +import type { IComponentConfig } from './hooks' +import type { IFileType } from './index' +import type { AppConfig, PageConfig } from '../index' + +export interface ViteNativeCompMeta { + name: string + scriptPath: string + configPath: string + config: PageConfig + isNative: true + templatePath: string + cssPath?: string + isPackage?: boolean +} + +export interface ViteFileType { + config: string + script: string + templ: string + style: string + xs?: string +} + +export interface ViteAppMeta { + name: string + scriptPath: string + configPath: string + config: AppConfig + isNative: false +} + +export interface VitePageMeta { + name: string + scriptPath: string + configPath: string + config: PageConfig + isNative: boolean + templatePath?: string + cssPath?: string +} + +export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> { + entryFileName?: string + runtimePath?: string | string[] +} + +export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfig { + fileType: IFileType + useETS?: boolean + useJSON5?: boolean + blended?: boolean + runtimePath?: string | string[] + isPure?: boolean + taroComponentsPath: string +} + +export interface CommonBuildConfig extends IProjectConfig<'vite'> { + entry: { + app: string | string[] + } + mode: 'production' | 'development' | 'none' + buildAdapter: string // weapp | swan | alipay | tt | qq | jd | h5 + platformType: string // mini | web + /** special mode */ + isBuildNativeComp?: boolean + /** hooks */ + onCompilerMake: (compilation) => Promise + onParseCreateElement: (nodeName, componentConfig) => Promise +} + + +export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'vite'> { + isBuildPlugin: boolean + isSupportRecursive: boolean + isSupportXS: boolean + nodeModulesPath: string + fileType: ViteFileType + globalObject: string + template: RecursiveTemplate | UnRecursiveTemplate + runtimePath?: string | string[] + taroComponentsPath: string + blended?: boolean + hot?: boolean + injectOptions?: { + include?: Record + exclude?: string[] + } + /** hooks */ + modifyComponentConfig: (componentConfig: IComponentConfig, config: Partial) => Promise +} + +export interface ViteCompilerContext { + cwd: string + sourceDir: string + taroConfig: T + rawTaroConfig: T + frameworkExts: string[] + app: ViteAppMeta + pages: VitePageMeta[] + components?: VitePageMeta[] + loaderMeta: any + logger + filesConfig: IMiniFilesConfig + configFileList: string[] + compilePage: (pageName: string) => VitePageMeta + watchConfigFile: (rollupCtx: PluginContext) => void + getAppScriptPath: () => string + getApp: () => ViteAppMeta + getPages: () => VitePageMeta[] + isApp: (id: string) => boolean + isPage: (id: string) => boolean + isComponent: (id: string) => boolean + isNativePageORComponent: (templatePath: string) => boolean + getPageById: (id: string) => VitePageMeta| undefined + getComponentById: (id: string) => VitePageMeta| undefined + getConfigFilePath: (filePath: string) => string + getTargetFilePath: (filePath: string, targetExtName: string) => string +} + +export interface ViteH5CompilerContext extends ViteCompilerContext { + getBrowserslist: () => void + routerMeta: { + routerCreator: string + getRoutesConfig: (pageName?: string) => string + } + browserslist: string[] +} + +export interface ViteHarmonyCompilerContext extends ViteCompilerContext { + nativeExt: string[] + fileType: ViteFileType + commonChunks: string[] + extraComponents: string[] + nativeComponents : Map + getCommonChunks: () => string[] + modifyHarmonyConfig: (config: Partial) => void + modifyHostPackage: (deps?: Record, devDeps?: Record) => Exclude + collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void + getScriptPath: (filePath: string) => string + getStylePath: (filePath: string) => string + getConfigPath: (filePath: string) => string +} + +export interface ViteMiniCompilerContext extends ViteCompilerContext { + fileType: ViteFileType + commonChunks: string[] + nativeComponents : Map + getCommonChunks: () => string[] + collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void + getScriptPath: (filePath: string) => string + getTemplatePath: (filePath: string) => string + getStylePath: (filePath: string) => string + getConfigPath: (filePath: string) => string +} diff --git a/packages/taro/types/index.d.ts b/packages/taro/types/index.d.ts index 5623c3254ae0..da8ec8360884 100644 --- a/packages/taro/types/index.d.ts +++ b/packages/taro/types/index.d.ts @@ -187,7 +187,6 @@ export as namespace Taro declare const Taro: Taro.TaroStatic declare namespace Taro { - // eslint-disable-next-line @typescript-eslint/no-empty-interface interface TaroStatic {} } declare global { diff --git a/packages/taro/types/taro.component.d.ts b/packages/taro/types/taro.component.d.ts index 0d0a4c502728..5ae244eaee6d 100644 --- a/packages/taro/types/taro.component.d.ts +++ b/packages/taro/types/taro.component.d.ts @@ -19,6 +19,7 @@ declare module './index' { shareTicket: string | undefined scene: number | undefined exitState?: any + $taroPath?: string } interface Show { @@ -129,6 +130,26 @@ declare module './index' { /** 是否返回变更的 data 字段信息 */ withDataPaths?: boolean }, listener: () => void): void + /** + * 绑定由 worklet 驱动的样式到相应的节点 + * @param selector 节点选择器 + * @param updater worklet 样式更新函数 + * @param config 配置项 + * @param callback 完成样式绑定的回调 + * */ + applyAnimatedStyle?(selector: string, updater: TaroGeneral.TFunc, config?: { + /** 是否立即执行一次 updater 函数 */ + immediate?: boolean + /** 刷新时机,枚举值 async / sync */ + flush?: string + }, callback?: TaroGeneral.TFunc): void + /** + * 清除节点上 worklet 驱动样式的绑定关系 + * @param selector 节点选择器 + * @param styleIds 需要清除的 styleId 集合 + * @param callback 清除样式绑定的回调 + * */ + clearAnimatedStyle?(selector: string, styleIds: Array, callback?: TaroGeneral.TFunc): void } interface PageInstance extends PageLifeCycle, ComponentInstance { /** 页面配置 */ diff --git a/packages/taro/types/taro.config.d.ts b/packages/taro/types/taro.config.d.ts index d5681eb0c0ba..1bae7fbde63f 100644 --- a/packages/taro/types/taro.config.d.ts +++ b/packages/taro/types/taro.config.d.ts @@ -32,6 +32,11 @@ declare module './index' { * @default: "#ffffff" */ backgroundColor?: string + /** 页面容器背景色, HexColor + * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html#%E8%AE%BE%E7%BD%AE%E9%A1%B5%E9%9D%A2%E9%80%8F%E6%98%8E + * @default: "#ffffff" + */ + backgroundColorContent?: string /** 下拉背景字体、loading 图的样式,仅支持 dark/light * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置 * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html From b64ab851988a3e05b659117b65b625c0bd24a53b Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Thu, 21 Nov 2024 09:44:57 +0800 Subject: [PATCH 2/7] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0api=E5=92=8C?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/apis/base/env/env.md | 2 +- docs/apis/base/system/getSystemInfo.md | 2 +- docs/apis/base/system/getSystemInfoSync.md | 2 +- docs/apis/base/weapp/app-event/offError.md | 2 +- .../weapp/app-event/offUnhandledRejection.md | 2 +- docs/apis/base/weapp/app-event/onError.md | 2 +- .../weapp/app-event/onUnhandledRejection.md | 2 +- .../accelerometer/offAccelerometerChange.md | 2 +- .../accelerometer/onAccelerometerChange.md | 2 +- .../accelerometer/startAccelerometer.md | 2 +- .../device/accelerometer/stopAccelerometer.md | 2 +- docs/apis/device/battery/getBatteryInfo.md | 2 +- .../apis/device/battery/getBatteryInfoSync.md | 2 +- .../apis/device/clipboard/getClipboardData.md | 2 +- .../apis/device/clipboard/setClipboardData.md | 2 +- .../keyboard/offKeyboardHeightChange.md | 2 +- .../device/keyboard/onKeyboardHeightChange.md | 2 +- docs/apis/device/network/getNetworkType.md | 2 +- .../device/network/offNetworkStatusChange.md | 2 +- .../device/network/onNetworkStatusChange.md | 2 +- docs/apis/device/phone/makePhoneCall.md | 2 +- .../apis/device/screen/getScreenBrightness.md | 2 +- docs/apis/device/vibrate/vibrateLong.md | 2 +- docs/apis/device/vibrate/vibrateShort.md | 2 +- docs/apis/media/image/compressImage.md | 2 +- docs/apis/media/image/getImageInfo.md | 2 +- docs/apis/media/image/previewImage.md | 2 +- docs/apis/network/request/request.md | 4 +- docs/apis/route/navigateBack.md | 2 +- docs/apis/route/navigateTo.md | 7 +- docs/apis/route/reLaunch.md | 2 +- docs/apis/route/redirectTo.md | 2 +- docs/apis/route/router.md | 126 +++++ docs/apis/route/switchTab.md | 2 +- docs/apis/skyline/DraggableSheetContext.md | 46 ++ docs/apis/skyline/worklet.md | 444 ++++++++++++++++++ docs/apis/storage/clearStorage.md | 2 +- docs/apis/storage/getStorage.md | 2 +- docs/apis/storage/removeStorage.md | 2 +- docs/apis/storage/setStorage.md | 2 +- docs/apis/taro.extend/getAppInfo.md | 2 +- docs/apis/ui/animation/createAnimation.md | 2 +- docs/apis/ui/interaction/showActionSheet.md | 2 +- docs/apis/ui/interaction/showModal.md | 2 +- docs/apis/ui/interaction/showToast.md | 2 +- docs/apis/ui/navigation-bar/hideHomeButton.md | 2 +- .../hideNavigationBarLoading.md | 2 +- .../navigation-bar/setNavigationBarColor.md | 2 +- .../navigation-bar/setNavigationBarTitle.md | 2 +- .../showNavigationBarLoading.md | 2 +- .../pull-down-refresh/startPullDownRefresh.md | 2 +- .../pull-down-refresh/stopPullDownRefresh.md | 2 +- docs/apis/ui/scroll/pageScrollTo.md | 2 +- docs/apis/ui/tab-bar/hideTabBar.md | 2 +- docs/apis/ui/tab-bar/hideTabBarRedDot.md | 2 +- docs/apis/ui/tab-bar/removeTabBarBadge.md | 2 +- docs/apis/ui/tab-bar/setTabBarBadge.md | 2 +- docs/apis/ui/tab-bar/setTabBarItem.md | 2 +- docs/apis/ui/tab-bar/showTabBar.md | 2 +- docs/apis/ui/tab-bar/showTabBarRedDot.md | 2 +- docs/apis/wxml/IntersectionObserver.md | 15 +- docs/apis/wxml/createIntersectionObserver.md | 2 +- docs/apis/wxml/createSelectorQuery.md | 2 +- docs/components/base/icon.md | 6 +- docs/components/base/progress.md | 2 +- docs/components/base/rich-text.md | 32 +- docs/components/base/text.md | 6 +- docs/components/forms/button.md | 10 +- docs/components/forms/checkbox.md | 10 +- docs/components/forms/editor.md | 26 +- docs/components/forms/form.md | 4 +- docs/components/forms/input.md | 42 +- docs/components/forms/label.md | 2 +- docs/components/forms/picker-view-column.md | 2 +- docs/components/forms/picker-view.md | 2 +- docs/components/forms/picker.md | 43 +- docs/components/forms/radio-group.md | 2 +- docs/components/forms/radio.md | 10 +- docs/components/forms/slider.md | 28 +- docs/components/forms/switch.md | 10 +- docs/components/forms/textarea.md | 24 +- .../gesture/double-tap-gesture-handler.md | 65 +++ .../gesture/force-press-gesture-handler.md | 63 +++ .../horizontal-drag-gesture-handler.md | 65 +++ .../gesture/long-press-gesture-handler.md | 65 +++ .../components/gesture/pan-gesture-handler.md | 65 +++ .../gesture/scale-gesture-handler.md | 65 +++ .../components/gesture/tap-gesture-handler.md | 65 +++ .../gesture/vertical-drag-gesture-handler.md | 65 +++ docs/components/media/camera.md | 2 +- docs/components/media/image.md | 4 +- docs/components/media/video.md | 32 +- docs/components/navig/navigation-bar.md | 8 +- docs/components/navig/navigator.md | 2 +- docs/components/page-meta.md | 14 +- docs/components/skyline/draggable-sheet.md | 2 + docs/components/skyline/list-view.md | 2 +- docs/components/skyline/share-element.md | 6 +- docs/components/skyline/sticky-header.md | 4 +- docs/components/skyline/sticky-section.md | 2 +- docs/components/viewContainer/cover-image.md | 2 +- docs/components/viewContainer/match-media.md | 20 +- .../viewContainer/page-container.md | 42 +- docs/components/viewContainer/scroll-view.md | 20 +- docs/components/viewContainer/slot.md | 2 +- docs/components/viewContainer/swiper-item.md | 2 +- docs/components/viewContainer/swiper.md | 69 +-- sidebars.js | 21 + 108 files changed, 1501 insertions(+), 290 deletions(-) create mode 100644 docs/apis/route/router.md create mode 100644 docs/apis/skyline/DraggableSheetContext.md create mode 100644 docs/apis/skyline/worklet.md create mode 100644 docs/components/gesture/double-tap-gesture-handler.md create mode 100644 docs/components/gesture/force-press-gesture-handler.md create mode 100644 docs/components/gesture/horizontal-drag-gesture-handler.md create mode 100644 docs/components/gesture/long-press-gesture-handler.md create mode 100644 docs/components/gesture/pan-gesture-handler.md create mode 100644 docs/components/gesture/scale-gesture-handler.md create mode 100644 docs/components/gesture/tap-gesture-handler.md create mode 100644 docs/components/gesture/vertical-drag-gesture-handler.md diff --git a/docs/apis/base/env/env.md b/docs/apis/base/env/env.md index 03d188dc5b06..e5620cff37b0 100644 --- a/docs/apis/base/env/env.md +++ b/docs/apis/base/env/env.md @@ -10,5 +10,5 @@ sidebar_label: env ## 类型 ```tsx -{ [key: string]: string; FRAMEWORK: "react" | "preact" | "nerv" | "vue" | "vue3"; TARO_ENV: "weapp" | "h5" | "rn" | "swan" | "alipay" | "tt" | "qq" | "jd" | "quickapp"; USER_DATA_PATH?: string; } +{ [key: string]: string; FRAMEWORK: "react" | "preact" | "solid" | "vue3"; TARO_ENV: "weapp" | "h5" | "rn" | "swan" | "alipay" | "tt" | "qq" | "jd" | "quickapp"; USER_DATA_PATH?: string; } ``` diff --git a/docs/apis/base/system/getSystemInfo.md b/docs/apis/base/system/getSystemInfo.md index 8280486b1d19..db76951c65ac 100644 --- a/docs/apis/base/system/getSystemInfo.md +++ b/docs/apis/base/system/getSystemInfo.md @@ -5,7 +5,7 @@ sidebar_label: getSystemInfo 获取系统信息,支持 `Promise` 化使用。 -支持情况: +支持情况: > 微信小程序: 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。 > diff --git a/docs/apis/base/system/getSystemInfoSync.md b/docs/apis/base/system/getSystemInfoSync.md index 7fa5b114cea5..7a400d7bddbc 100644 --- a/docs/apis/base/system/getSystemInfoSync.md +++ b/docs/apis/base/system/getSystemInfoSync.md @@ -5,7 +5,7 @@ sidebar_label: getSystemInfoSync [Taro.getSystemInfo](./getSystemInfo) 的同步版本 -支持情况: +支持情况: > 微信小程序: 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。 > diff --git a/docs/apis/base/weapp/app-event/offError.md b/docs/apis/base/weapp/app-event/offError.md index eac8fc51901d..643a26df4c0c 100644 --- a/docs/apis/base/weapp/app-event/offError.md +++ b/docs/apis/base/weapp/app-event/offError.md @@ -5,7 +5,7 @@ sidebar_label: offError 取消监听音频播放错误事件 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html) diff --git a/docs/apis/base/weapp/app-event/offUnhandledRejection.md b/docs/apis/base/weapp/app-event/offUnhandledRejection.md index 059bbe3af845..bd0c9e1cc352 100644 --- a/docs/apis/base/weapp/app-event/offUnhandledRejection.md +++ b/docs/apis/base/weapp/app-event/offUnhandledRejection.md @@ -5,7 +5,7 @@ sidebar_label: offUnhandledRejection 取消监听未处理的 Promise 拒绝事件 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html) diff --git a/docs/apis/base/weapp/app-event/onError.md b/docs/apis/base/weapp/app-event/onError.md index cef630673553..75bc173484b0 100644 --- a/docs/apis/base/weapp/app-event/onError.md +++ b/docs/apis/base/weapp/app-event/onError.md @@ -5,7 +5,7 @@ sidebar_label: onError 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html) diff --git a/docs/apis/base/weapp/app-event/onUnhandledRejection.md b/docs/apis/base/weapp/app-event/onUnhandledRejection.md index 8a3bdbd0769c..a43ea7bee4c6 100644 --- a/docs/apis/base/weapp/app-event/onUnhandledRejection.md +++ b/docs/apis/base/weapp/app-event/onUnhandledRejection.md @@ -8,7 +8,7 @@ sidebar_label: onUnhandledRejection **注意** - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) diff --git a/docs/apis/device/accelerometer/offAccelerometerChange.md b/docs/apis/device/accelerometer/offAccelerometerChange.md index 4dadacc7dc52..cba9a4a25a36 100644 --- a/docs/apis/device/accelerometer/offAccelerometerChange.md +++ b/docs/apis/device/accelerometer/offAccelerometerChange.md @@ -5,7 +5,7 @@ sidebar_label: offAccelerometerChange 取消监听加速度数据事件,参数为空,则取消所有的事件监听。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html) diff --git a/docs/apis/device/accelerometer/onAccelerometerChange.md b/docs/apis/device/accelerometer/onAccelerometerChange.md index f2f4da2692eb..1084a3aa0677 100644 --- a/docs/apis/device/accelerometer/onAccelerometerChange.md +++ b/docs/apis/device/accelerometer/onAccelerometerChange.md @@ -5,7 +5,7 @@ sidebar_label: onAccelerometerChange 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 `Taro.stopAccelerometer` 停止监听。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html) diff --git a/docs/apis/device/accelerometer/startAccelerometer.md b/docs/apis/device/accelerometer/startAccelerometer.md index 68e062742ba6..7e1f11a58a75 100644 --- a/docs/apis/device/accelerometer/startAccelerometer.md +++ b/docs/apis/device/accelerometer/startAccelerometer.md @@ -5,7 +5,7 @@ sidebar_label: startAccelerometer 开始监听加速度数据。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) diff --git a/docs/apis/device/accelerometer/stopAccelerometer.md b/docs/apis/device/accelerometer/stopAccelerometer.md index 0e3fa7b7e939..e00856810b4c 100644 --- a/docs/apis/device/accelerometer/stopAccelerometer.md +++ b/docs/apis/device/accelerometer/stopAccelerometer.md @@ -5,7 +5,7 @@ sidebar_label: stopAccelerometer 停止监听加速度数据。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html) diff --git a/docs/apis/device/battery/getBatteryInfo.md b/docs/apis/device/battery/getBatteryInfo.md index 2af346c6401b..1cafac6c99a8 100644 --- a/docs/apis/device/battery/getBatteryInfo.md +++ b/docs/apis/device/battery/getBatteryInfo.md @@ -5,7 +5,7 @@ sidebar_label: getBatteryInfo 获取设备电量。同步 API Taro.getBatteryInfoSync 在 iOS 上不可用。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) diff --git a/docs/apis/device/battery/getBatteryInfoSync.md b/docs/apis/device/battery/getBatteryInfoSync.md index 82f54498f9d5..4d798eb0ba48 100644 --- a/docs/apis/device/battery/getBatteryInfoSync.md +++ b/docs/apis/device/battery/getBatteryInfoSync.md @@ -5,7 +5,7 @@ sidebar_label: getBatteryInfoSync Taro.getBatteryInfo 的同步版本 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) diff --git a/docs/apis/device/clipboard/getClipboardData.md b/docs/apis/device/clipboard/getClipboardData.md index a92302f12f03..6be0dc663b30 100644 --- a/docs/apis/device/clipboard/getClipboardData.md +++ b/docs/apis/device/clipboard/getClipboardData.md @@ -5,7 +5,7 @@ sidebar_label: getClipboardData 获取系统剪贴板内容 -支持情况: +支持情况: > H5: 部分实现 diff --git a/docs/apis/device/clipboard/setClipboardData.md b/docs/apis/device/clipboard/setClipboardData.md index 66107a7505dc..c5cd0e79aadb 100644 --- a/docs/apis/device/clipboard/setClipboardData.md +++ b/docs/apis/device/clipboard/setClipboardData.md @@ -5,7 +5,7 @@ sidebar_label: setClipboardData 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s -支持情况: +支持情况: > H5: 部分实现 diff --git a/docs/apis/device/keyboard/offKeyboardHeightChange.md b/docs/apis/device/keyboard/offKeyboardHeightChange.md index 9ded00f741c0..9650bb4ea033 100644 --- a/docs/apis/device/keyboard/offKeyboardHeightChange.md +++ b/docs/apis/device/keyboard/offKeyboardHeightChange.md @@ -5,7 +5,7 @@ sidebar_label: offKeyboardHeightChange 取消监听键盘高度变化事件。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html) diff --git a/docs/apis/device/keyboard/onKeyboardHeightChange.md b/docs/apis/device/keyboard/onKeyboardHeightChange.md index fe7c4ad1c585..6c7bfbce33f1 100644 --- a/docs/apis/device/keyboard/onKeyboardHeightChange.md +++ b/docs/apis/device/keyboard/onKeyboardHeightChange.md @@ -5,7 +5,7 @@ sidebar_label: onKeyboardHeightChange 监听键盘高度变化 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html) diff --git a/docs/apis/device/network/getNetworkType.md b/docs/apis/device/network/getNetworkType.md index 4d41dba95040..4173e7b6fddb 100644 --- a/docs/apis/device/network/getNetworkType.md +++ b/docs/apis/device/network/getNetworkType.md @@ -5,7 +5,7 @@ sidebar_label: getNetworkType 获取网络类型。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html) diff --git a/docs/apis/device/network/offNetworkStatusChange.md b/docs/apis/device/network/offNetworkStatusChange.md index bac9bffc9aa8..03c6bb181c7a 100644 --- a/docs/apis/device/network/offNetworkStatusChange.md +++ b/docs/apis/device/network/offNetworkStatusChange.md @@ -5,7 +5,7 @@ sidebar_label: offNetworkStatusChange 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html) diff --git a/docs/apis/device/network/onNetworkStatusChange.md b/docs/apis/device/network/onNetworkStatusChange.md index 330e7a1a2931..b678c3f48f85 100644 --- a/docs/apis/device/network/onNetworkStatusChange.md +++ b/docs/apis/device/network/onNetworkStatusChange.md @@ -5,7 +5,7 @@ sidebar_label: onNetworkStatusChange 监听网络状态变化。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html) diff --git a/docs/apis/device/phone/makePhoneCall.md b/docs/apis/device/phone/makePhoneCall.md index 4e418dd7ce3d..69750be63927 100644 --- a/docs/apis/device/phone/makePhoneCall.md +++ b/docs/apis/device/phone/makePhoneCall.md @@ -5,7 +5,7 @@ sidebar_label: makePhoneCall 拨打电话 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html) diff --git a/docs/apis/device/screen/getScreenBrightness.md b/docs/apis/device/screen/getScreenBrightness.md index d8296c253e98..60bfde2c04e4 100644 --- a/docs/apis/device/screen/getScreenBrightness.md +++ b/docs/apis/device/screen/getScreenBrightness.md @@ -8,7 +8,7 @@ sidebar_label: getScreenBrightness **说明** - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html) diff --git a/docs/apis/device/vibrate/vibrateLong.md b/docs/apis/device/vibrate/vibrateLong.md index 158e6fda6175..5dda75654d05 100644 --- a/docs/apis/device/vibrate/vibrateLong.md +++ b/docs/apis/device/vibrate/vibrateLong.md @@ -5,7 +5,7 @@ sidebar_label: vibrateLong 使手机发生较长时间的振动(400ms) -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html) diff --git a/docs/apis/device/vibrate/vibrateShort.md b/docs/apis/device/vibrate/vibrateShort.md index 831628dbab3a..6041a15aef01 100644 --- a/docs/apis/device/vibrate/vibrateShort.md +++ b/docs/apis/device/vibrate/vibrateShort.md @@ -7,7 +7,7 @@ sidebar_label: vibrateShort 仅微信小程序平台支持 type 参数 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html) diff --git a/docs/apis/media/image/compressImage.md b/docs/apis/media/image/compressImage.md index 33be3beb59f0..e1cbaad88083 100644 --- a/docs/apis/media/image/compressImage.md +++ b/docs/apis/media/image/compressImage.md @@ -30,7 +30,7 @@ sidebar_label: compressImage | fail | `(res: TaroGeneral.CallbackResult) => void` | 否 | 接口调用失败的回调函数 | | quality | `number` | 否 | 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 | | compressedWidth | `number` | 否 | 压缩后图片的宽度,单位为px,若不填写则默认以 compressedHeight 为准等比缩放。 | -| compressHeight | `number` | 否 | 压缩后图片的高度,单位为px,若不填写则默认以 compressedWidth 为准等比缩放。 | +| compressedHeight | `number` | 否 | 压缩后图片的高度,单位为px,若不填写则默认以 compressedWidth 为准等比缩放。 | | success | `(result: SuccessCallbackResult) => void` | 否 | 接口调用成功的回调函数 | ### SuccessCallbackResult diff --git a/docs/apis/media/image/getImageInfo.md b/docs/apis/media/image/getImageInfo.md index 4e24ea700d72..94df96b59980 100644 --- a/docs/apis/media/image/getImageInfo.md +++ b/docs/apis/media/image/getImageInfo.md @@ -5,7 +5,7 @@ sidebar_label: getImageInfo 获取图片信息。网络图片需先配置download域名才能生效。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html) diff --git a/docs/apis/media/image/previewImage.md b/docs/apis/media/image/previewImage.md index 0a3e725c1d95..b9c7a2f2e505 100644 --- a/docs/apis/media/image/previewImage.md +++ b/docs/apis/media/image/previewImage.md @@ -26,7 +26,7 @@ sidebar_label: previewImage | 参数 | 类型 | 必填 | 说明 | | --- | --- | :---: | --- | | urls | `string[]` | 是 | 需要预览的图片链接列表。 | -| current | string or number | 否 | 微信端为当前显示图片的链接,支付宝端为当前显示图片的索引值 | +| current | string or number | 否 | 当前显示图片的http链接 | | enablesavephoto | `boolean` | 否 | 是否支持长按下载图片
API 支持度: alipay 基础库: 1.13.0 | | enableShowPhotoDownload | `boolean` | 否 | 是否在右下角显示下载入口
API 支持度: alipay 基础库: 1.13.0 | | showmenu | `boolean` | 否 |
API 支持度: weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true | diff --git a/docs/apis/network/request/request.md b/docs/apis/network/request/request.md index 3d169543c479..12c6d5a272d4 100644 --- a/docs/apis/network/request/request.md +++ b/docs/apis/network/request/request.md @@ -11,7 +11,7 @@ sidebar_label: request - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化 - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)` -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html) @@ -49,7 +49,7 @@ sidebar_label: request | referrerStrategy | `keyof ReferrerStrategy` | `"querystring"` | 否 | referer 策略,用于控制当前请求 header 对象中 referer 字段格式。该参数默认值可通过 app.json 中的配置进行修改。
API 支持度: alipay 支付宝: 10.3.50+ APPX: 2.8.7 开发者工具: 3.5.1
[参考地址](https://opendocs.alipay.com/mini/api/owycmh#referrerStrategy%20%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E) | | success | `(result: SuccessCallbackResult) => void` | | 否 | 接口调用成功的回调函数 | | fail | `(res: TaroGeneral.CallbackResult) => void` | | 否 | 接口调用失败的回调函数 | -| complete | `(res: TaroGeneral.CallbackResult) => void` | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | +| complete | `(res: Partial & TaroGeneral.CallbackResult) => void` | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | | jsonp | string or boolean | `false` | 否 | 设置是否使用 jsonp 方式获取数据
API 支持度: h5 | | jsonpCache | `RequestCache` | | 否 | 设置 jsonp 请求 url 是否需要被缓存
API 支持度: h5 | | mode | `keyof CorsMode` | `"same-origin"` | 否 | 设置是否允许跨域请求
API 支持度: h5 | diff --git a/docs/apis/route/navigateBack.md b/docs/apis/route/navigateBack.md index f36563155c2a..362ea873ab31 100644 --- a/docs/apis/route/navigateBack.md +++ b/docs/apis/route/navigateBack.md @@ -5,7 +5,7 @@ sidebar_label: navigateBack 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。 -支持情况: +支持情况: > H5: 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。 diff --git a/docs/apis/route/navigateTo.md b/docs/apis/route/navigateTo.md index d68ff18c187b..a9ac1fa079db 100644 --- a/docs/apis/route/navigateTo.md +++ b/docs/apis/route/navigateTo.md @@ -5,7 +5,7 @@ sidebar_label: navigateTo 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。 -支持情况: +支持情况: > H5: 未针对 tabbar 页面做限制处理 @@ -28,8 +28,11 @@ sidebar_label: navigateTo | 参数 | 类型 | 必填 | 说明 | | --- | --- | :---: | --- | | url | `string` | 是 | 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' | -| complete | `(res: TaroGeneral.CallbackResult) => void` | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | | events | `TaroGeneral.IAnyObject` | 否 | 页面间通信接口,用于监听被打开页面发送到当前页面的数据。 | +| routeType | `string` | 否 | 2.29.2 自定义路由类型 | +| routeConfig | `TaroGeneral.IAnyObject` | 否 | 3.4.0 自定义路由配置 | +| routeOptions | `TaroGeneral.IAnyObject` | 否 | 3.4.0 自定义路由参数 | +| complete | `(res: TaroGeneral.CallbackResult) => void` | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | | fail | `(res: TaroGeneral.CallbackResult) => void` | 否 | 接口调用失败的回调函数 | | success | `(res: any) => void` | 否 | 接口调用成功的回调函数 | diff --git a/docs/apis/route/reLaunch.md b/docs/apis/route/reLaunch.md index 9336ebbd57cc..698061d2fd88 100644 --- a/docs/apis/route/reLaunch.md +++ b/docs/apis/route/reLaunch.md @@ -5,7 +5,7 @@ sidebar_label: reLaunch 关闭所有页面,打开到应用内的某个页面 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html) diff --git a/docs/apis/route/redirectTo.md b/docs/apis/route/redirectTo.md index c51a3645fb78..558f987f5439 100644 --- a/docs/apis/route/redirectTo.md +++ b/docs/apis/route/redirectTo.md @@ -5,7 +5,7 @@ sidebar_label: redirectTo 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 -支持情况: +支持情况: > H5: 未针对 tabbar 页面做限制处理 diff --git a/docs/apis/route/router.md b/docs/apis/route/router.md new file mode 100644 index 000000000000..c920097ef4a5 --- /dev/null +++ b/docs/apis/route/router.md @@ -0,0 +1,126 @@ +--- +title: router +sidebar_label: router +--- + +## 类型 + +```tsx +router +``` + +## 参数 + +### CustomRouteBuilder + +```tsx +(routeContext: CustomRouteContext,routeOptions: Record) => CustomRouteConfig +``` + +| 参数 | 类型 | +| --- | --- | +| routeContext | `CustomRouteContext` | +| routeOptions | `Record` | + +### SharedValue + +| 参数 | 类型 | +| --- | --- | +| value | `T` | + +### CustomRouteContext + +| 参数 | 类型 | +| --- | --- | +| primaryAnimation | `SharedValue` | +| primaryAnimationStatus | `SharedValue` | +| secondaryAnimation | `SharedValue` | +| secondaryAnimationStatus | `SharedValue` | +| userGestureInProgress | `SharedValue` | +| startUserGesture | `() => void` | +| stopUserGesture | `() => void` | +| didPop | `() => void` | + +### CustomRouteConfig + +| 参数 | 类型 | 必填 | +| --- | --- | :---: | +| opaque | `boolean` | 否 | +| maintainState | `boolean` | 否 | +| transitionDuration | `number` | 否 | +| reverseTransitionDuration | `number` | 否 | +| barrierColor | `string` | 否 | +| barrierDismissible | `boolean` | 否 | +| barrierLabel | `string` | 否 | +| canTransitionTo | `boolean` | 否 | +| canTransitionFrom | `boolean` | 否 | +| handlePrimaryAnimation | `RouteAnimationHandler` | 否 | +| handleSecondaryAnimation | `RouteAnimationHandler` | 否 | +| handlePreviousPageAnimation | `RouteAnimationHandler` | 否 | +| allowEnterRouteSnapshotting | `boolean` | 否 | +| allowExitRouteSnapshotting | `boolean` | 否 | +| fullscreenDrag | `boolean` | 否 | +| popGestureDirection | "horizontal" or "vertical" or "multi" | 否 | + +### RouteAnimationHandler + +```tsx +() => { [key: string]: any; } +``` + +### router + +自定义路由 + +支持情况: + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/wx.router.html) + +#### addRouteBuilder + +添加自定义路由配置 + +支持情况: + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.addRouteBuilder.html) + +```tsx +(routeType: string, routeBuilder: CustomRouteBuilder) => void +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| routeType | `string` | 路由类型 | +| routeBuilder | `CustomRouteBuilder` | 路由动画定义函数 | + +#### getRouteContext + +获取页面对应的自定义路由上下文对象 + +支持情况: + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.getRouteContext.html) + +```tsx +(instance: TaroGeneral.IAnyObject) => CustomRouteContext +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| instance | `TaroGeneral.IAnyObject` | 页面/自定义组件实例 | + +#### removeRouteBuilder + +移除自定义路由配置 + +支持情况: + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.removeRouteBuilder.html) + +```tsx +(routeType: string) => void +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| routeType | `string` | 路由类型 | diff --git a/docs/apis/route/switchTab.md b/docs/apis/route/switchTab.md index 50d43c1f9af7..ef0a84ac3bc8 100644 --- a/docs/apis/route/switchTab.md +++ b/docs/apis/route/switchTab.md @@ -5,7 +5,7 @@ sidebar_label: switchTab 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html) diff --git a/docs/apis/skyline/DraggableSheetContext.md b/docs/apis/skyline/DraggableSheetContext.md new file mode 100644 index 000000000000..4c152037151d --- /dev/null +++ b/docs/apis/skyline/DraggableSheetContext.md @@ -0,0 +1,46 @@ +--- +title: DraggableSheetContext +sidebar_label: DraggableSheetContext +--- + +DraggableSheet 实例,可通过 Taro.createSelectorQuery 的 NodesRef.node 方法获取。 + +支持情况: + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.html) + +## 方法 + +### scrollTo + +滚动到指定位置。size 取值 [0, 1],size = 1 时表示撑满 draggable-sheet 组件。size 和 pixels 同时传入时,仅 size 生效。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.scrollTo.html) + +```tsx +(option: Option) => void +``` + +| 参数 | 类型 | +| --- | --- | +| option | `Option` | + +## 参数 + +### scrollTo + +#### Option + +| 参数 | 类型 | 默认值 | 必填 | 说明 | +| --- | --- | :---: | :---: | --- | +| size | `number` | | 否 | 相对目标位置 | +| pixels | `number` | | 否 | 绝对目标位置 | +| animated | `boolean` | `true` | 否 | 是否启用滚动动画 | +| duration | `number` | `300` | 否 | 滚动动画时长(ms) | +| easingFunction | `string` | `ease` | 否 | 缓动函数 | + +## API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| DraggableSheetContext | ✔️ | | | | diff --git a/docs/apis/skyline/worklet.md b/docs/apis/skyline/worklet.md new file mode 100644 index 000000000000..926b2f4b6807 --- /dev/null +++ b/docs/apis/skyline/worklet.md @@ -0,0 +1,444 @@ +--- +title: worklet +sidebar_label: worklet +--- + +worklet 对象,可以通过 wx.worklet 获取 + +支持情况: + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html) + +## 类型 + +```tsx +worklet +``` + +## 方法 + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| scrollViewContext | `{ scrollTo(NodesRef: TaroGeneral.IAnyObject, object: Option): void; }` | ScrollView 实例,可在 worklet 函数内操作 scroll-view 组件。
[参考地址](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.html) | +| Easing | `Easing` | | + +### cancelAnimation + +取消由 SharedValue 驱动的动画 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html) + +```tsx +(SharedValue: TaroGeneral.IAnyObject) => void +``` + +| 参数 | 类型 | +| --- | --- | +| SharedValue | `TaroGeneral.IAnyObject` | + +### derived + +衍生值 DerivedValue,可基于已有的 SharedValue 生成其它共享变量。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html) + +```tsx +(updaterWorklet: TaroGeneral.TFunc) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | +| --- | --- | +| updaterWorklet | `TaroGeneral.TFunc` | + +### shared + +创建共享变量 SharedValue,用于跨线程共享数据和驱动动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html) + +```tsx +(initialValue: any) => TaroGeneral.IAnyObject +``` + +### decay + +基于滚动衰减的动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html) + +```tsx +(options?: Option, callback?: (flag: boolean) => void) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| options | `Option` | 动画配置
param: options 动画配置 | +| callback | `(flag: boolean) => void` | 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
param: callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 | + +### spring + +基于物理的动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html) + +```tsx +(toValue: string | number, options?: Option, callback?: (flag: boolean) => void) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| toValue | string or number | 目标值
param: toValue 目标值 | +| options | `Option` | 动画配置
param: options 动画配置 | +| callback | `(flag: boolean) => void` | 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
param: callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 | + +### timing + +基于时间的动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html) + +```tsx +(toValue: string | number, options?: Option, callback?: (flag: boolean) => void) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| toValue | string or number | 目标值
param: toValue 目标值 | +| options | `Option` | 动画配置
param: options 动画配置 | +| callback | `(flag: boolean) => void` | 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
param: callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 | + +### delay + +延迟执行动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html) + +```tsx +(delayMS: number, delayedAnimation: TaroGeneral.IAnyObject) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| delayMS | `number` | 动画开始前等待的时间,单位:毫秒
param: delayMS 动画开始前等待的时间,单位:毫秒 | +| delayedAnimation | `TaroGeneral.IAnyObject` | 动画对象
param: delayedAnimation 动画对象 | + +### repeat + +重复执行动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html) + +```tsx +(delayedAnimation: TaroGeneral.IAnyObject, numberOfReps: number, reverse?: boolean, callback?: (flag: boolean) => void) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| delayedAnimation | `TaroGeneral.IAnyObject` | | +| numberOfReps | `number` | 重复次数。为负值时一直循环,直到被取消动画。
param: numberOfReps 重复次数。为负值时一直循环,直到被取消动画。 | +| reverse | `boolean` | 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。
param: reverse 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。 | +| callback | `(flag: boolean) => void` | 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
param: callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 | + +### sequence + +组合动画序列,依次执行传入的动画。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html) + +```tsx +(...delayedAnimation: TaroGeneral.IAnyObject) => TaroGeneral.IAnyObject +``` + +| 参数 | 类型 | +| --- | --- | +| delayedAnimation | `TaroGeneral.IAnyObject` | + +### runOnJS + +worklet 函数运行在 UI 线程时,捕获的外部函数可能为 worklet 类型或普通函数,为了更明显的对其区分,要求必须使用 runOnJS 调回 JS 线程的普通函数。 有这样的要求是因为,调用其它 worklet 函数时是同步调用,但在 UI 线程执行 JS 线程的函数只能是异步,开发者容易混淆,试图同步获取 JS 线程的返回值。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html) + +```tsx +(fn: TaroGeneral.TFunc) => TaroGeneral.TFunc +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| fn | `TaroGeneral.TFunc` | worklet 类型函数
param: fn worklet 类型函数 | + +### runOnUI + +在 UI 线程执行 worklet 函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html) + +```tsx +(fn: TaroGeneral.TFunc) => TaroGeneral.TFunc +``` + +| 参数 | 类型 | 说明 | +| --- | --- | --- | +| fn | `TaroGeneral.TFunc` | worklet 类型函数
param: fn worklet 类型函数 | + +## 参数 + +### SharedValue + +### DerivedValue + +### AnimationObject + +### WorkletFunction + +### scrollViewContext + +#### Option + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| top | `number` | 否 | 顶部距离 | +| left | `number` | 否 | 左边界距离 | +| duration | `number` | 否 | 滚动动画时长 | +| animated | `boolean` | 否 | 是否启用滚动动画 | +| easingFunction | `string` | 否 | 动画曲线 | + +### decay + +#### Option + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| velocity | `number` | 否 | 初速度 | +| deceleration | `number` | 否 | 衰减速率 | +| clamp | `number[]` | 否 | 边界值,长度为 2 的数组 | + +### Easing + +#### bounce + +简单的反弹效果 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### ease + +简单的惯性动画 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### elastic + +简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(bounciness?: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| bounciness | `number` | + +#### linear + +线性函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### quad + +二次方函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### cubic + +立方函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### poly + +高阶函数,返回幂函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(n: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| n | `number` | + +#### bezier + +三次贝塞尔曲线,效果同 css transition-timing-function + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(x1: number, y1: number, x2: number, y2: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| x1 | `number` | +| y1 | `number` | +| x2 | `number` | +| y2 | `number` | + +#### circle + +圆形曲线 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### sin + +正弦函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### exp + +指数函数 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(t: number) => any +``` + +| 参数 | 类型 | +| --- | --- | +| t | `number` | + +#### in + +正向运行 easing function,高阶函数。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(easing: (t: number) => any) => any +``` + +| 参数 | 类型 | +| --- | --- | +| easing | `(t: number) => any` | + +#### out + +反向运行 easing function,高阶函数。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(easing: (t: number) => any) => any +``` + +| 参数 | 类型 | +| --- | --- | +| easing | `(t: number) => any` | + +#### inOut + +前半程正向,后半程反向,高阶函数。 + +> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) + +```tsx +(easing: (t: number) => any) => any +``` + +| 参数 | 类型 | +| --- | --- | +| easing | `(t: number) => any` | + +### spring + +#### Option + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| damping | `number` | 否 | 阻尼系数 | +| mass | `number` | 否 | 重量系数,值越大移动越慢 | +| stiffness | `number` | 否 | 弹性系数 | +| overshootClamping | `boolean` | 否 | 动画是否可以在指定值上反弹 | +| restDisplacementThreshold | `number` | 否 | 弹簧静止时的位移 | +| restSpeedThreshold | `number` | 否 | 弹簧静止的速度 | +| velocity | `number` | 否 | 速度 | + +### timing + +#### Option + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| duration | `number` | 否 | 动画时长 | +| easing | `(t: number) => number` | 否 | 动画曲线 | + +## API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| worklet | ✔️ | | | | diff --git a/docs/apis/storage/clearStorage.md b/docs/apis/storage/clearStorage.md index d29b2ed4a6ac..fdc20d668ceb 100644 --- a/docs/apis/storage/clearStorage.md +++ b/docs/apis/storage/clearStorage.md @@ -5,7 +5,7 @@ sidebar_label: clearStorage 清理本地数据缓存 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) diff --git a/docs/apis/storage/getStorage.md b/docs/apis/storage/getStorage.md index df0e9a2943ef..d07b6495da1d 100644 --- a/docs/apis/storage/getStorage.md +++ b/docs/apis/storage/getStorage.md @@ -5,7 +5,7 @@ sidebar_label: getStorage 从本地缓存中异步获取指定 key 的内容 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html) diff --git a/docs/apis/storage/removeStorage.md b/docs/apis/storage/removeStorage.md index c5c7e515765d..3ac6e39d1a14 100644 --- a/docs/apis/storage/removeStorage.md +++ b/docs/apis/storage/removeStorage.md @@ -5,7 +5,7 @@ sidebar_label: removeStorage 从本地缓存中移除指定 key -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) diff --git a/docs/apis/storage/setStorage.md b/docs/apis/storage/setStorage.md index a1e72f088ba5..7ad5285e2ef0 100644 --- a/docs/apis/storage/setStorage.md +++ b/docs/apis/storage/setStorage.md @@ -5,7 +5,7 @@ sidebar_label: setStorage 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html) diff --git a/docs/apis/taro.extend/getAppInfo.md b/docs/apis/taro.extend/getAppInfo.md index f32b2979f945..6c339f9087ff 100644 --- a/docs/apis/taro.extend/getAppInfo.md +++ b/docs/apis/taro.extend/getAppInfo.md @@ -5,7 +5,7 @@ sidebar_label: getAppInfo 小程序获取和 Taro 相关的 App 信息 -支持情况: +支持情况: ## 类型 diff --git a/docs/apis/ui/animation/createAnimation.md b/docs/apis/ui/animation/createAnimation.md index a410f065ff8f..bd5161dd9d88 100644 --- a/docs/apis/ui/animation/createAnimation.md +++ b/docs/apis/ui/animation/createAnimation.md @@ -5,7 +5,7 @@ sidebar_label: createAnimation 创建一个动画实例 [animation](../Animation)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html) diff --git a/docs/apis/ui/interaction/showActionSheet.md b/docs/apis/ui/interaction/showActionSheet.md index 50c4762d033f..7c4648051bc0 100644 --- a/docs/apis/ui/interaction/showActionSheet.md +++ b/docs/apis/ui/interaction/showActionSheet.md @@ -9,7 +9,7 @@ sidebar_label: showActionSheet - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html) diff --git a/docs/apis/ui/interaction/showModal.md b/docs/apis/ui/interaction/showModal.md index 1287bd1f5939..aaef1bb0358e 100644 --- a/docs/apis/ui/interaction/showModal.md +++ b/docs/apis/ui/interaction/showModal.md @@ -8,7 +8,7 @@ sidebar_label: showModal - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html) diff --git a/docs/apis/ui/interaction/showToast.md b/docs/apis/ui/interaction/showToast.md index 38d31fdce99a..db5b09aaa420 100644 --- a/docs/apis/ui/interaction/showToast.md +++ b/docs/apis/ui/interaction/showToast.md @@ -9,7 +9,7 @@ sidebar_label: showToast - Taro.showLoading 和 Taro.showToast 同时只能显示一个 - Taro.showToast 应与 Taro.hideToast 配对使用 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) diff --git a/docs/apis/ui/navigation-bar/hideHomeButton.md b/docs/apis/ui/navigation-bar/hideHomeButton.md index f76a23ddd11c..9e815cb907d8 100644 --- a/docs/apis/ui/navigation-bar/hideHomeButton.md +++ b/docs/apis/ui/navigation-bar/hideHomeButton.md @@ -5,7 +5,7 @@ sidebar_label: hideHomeButton 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html) diff --git a/docs/apis/ui/navigation-bar/hideNavigationBarLoading.md b/docs/apis/ui/navigation-bar/hideNavigationBarLoading.md index 2c55548c93de..2066167ff939 100644 --- a/docs/apis/ui/navigation-bar/hideNavigationBarLoading.md +++ b/docs/apis/ui/navigation-bar/hideNavigationBarLoading.md @@ -5,7 +5,7 @@ sidebar_label: hideNavigationBarLoading 在当前页面隐藏导航条加载动画 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html) diff --git a/docs/apis/ui/navigation-bar/setNavigationBarColor.md b/docs/apis/ui/navigation-bar/setNavigationBarColor.md index de08853a1ebd..1e0c83bcf0de 100644 --- a/docs/apis/ui/navigation-bar/setNavigationBarColor.md +++ b/docs/apis/ui/navigation-bar/setNavigationBarColor.md @@ -5,7 +5,7 @@ sidebar_label: setNavigationBarColor 设置页面导航条颜色 -支持情况: +支持情况: > H5: 不支持 animation 参数 > diff --git a/docs/apis/ui/navigation-bar/setNavigationBarTitle.md b/docs/apis/ui/navigation-bar/setNavigationBarTitle.md index a9c7c951f3f1..76a00c92fa34 100644 --- a/docs/apis/ui/navigation-bar/setNavigationBarTitle.md +++ b/docs/apis/ui/navigation-bar/setNavigationBarTitle.md @@ -5,7 +5,7 @@ sidebar_label: setNavigationBarTitle 动态设置当前页面的标题 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html) diff --git a/docs/apis/ui/navigation-bar/showNavigationBarLoading.md b/docs/apis/ui/navigation-bar/showNavigationBarLoading.md index f554e6107d4c..1f8662171d7d 100644 --- a/docs/apis/ui/navigation-bar/showNavigationBarLoading.md +++ b/docs/apis/ui/navigation-bar/showNavigationBarLoading.md @@ -5,7 +5,7 @@ sidebar_label: showNavigationBarLoading 在当前页面显示导航条加载动画 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html) diff --git a/docs/apis/ui/pull-down-refresh/startPullDownRefresh.md b/docs/apis/ui/pull-down-refresh/startPullDownRefresh.md index 147ee2f6648b..f353ce96e9d0 100644 --- a/docs/apis/ui/pull-down-refresh/startPullDownRefresh.md +++ b/docs/apis/ui/pull-down-refresh/startPullDownRefresh.md @@ -5,7 +5,7 @@ sidebar_label: startPullDownRefresh 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。 -支持情况: +支持情况: > React Native: 无动画效果 diff --git a/docs/apis/ui/pull-down-refresh/stopPullDownRefresh.md b/docs/apis/ui/pull-down-refresh/stopPullDownRefresh.md index e07a418f059e..8033ac95afbf 100644 --- a/docs/apis/ui/pull-down-refresh/stopPullDownRefresh.md +++ b/docs/apis/ui/pull-down-refresh/stopPullDownRefresh.md @@ -5,7 +5,7 @@ sidebar_label: stopPullDownRefresh 停止当前页面下拉刷新。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html) diff --git a/docs/apis/ui/scroll/pageScrollTo.md b/docs/apis/ui/scroll/pageScrollTo.md index 2a2d867bd8bd..dad4a38327ca 100644 --- a/docs/apis/ui/scroll/pageScrollTo.md +++ b/docs/apis/ui/scroll/pageScrollTo.md @@ -15,7 +15,7 @@ selector类似于 CSS 的选择器,但仅支持下列语法。 - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant - 多选择器的并集:#a-node, .some-other-nodes -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html) diff --git a/docs/apis/ui/tab-bar/hideTabBar.md b/docs/apis/ui/tab-bar/hideTabBar.md index c4458ca65f1f..082adce21453 100644 --- a/docs/apis/ui/tab-bar/hideTabBar.md +++ b/docs/apis/ui/tab-bar/hideTabBar.md @@ -5,7 +5,7 @@ sidebar_label: hideTabBar 隐藏 tabBar -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html) diff --git a/docs/apis/ui/tab-bar/hideTabBarRedDot.md b/docs/apis/ui/tab-bar/hideTabBarRedDot.md index 2c3da47bc628..6808c96d0b48 100644 --- a/docs/apis/ui/tab-bar/hideTabBarRedDot.md +++ b/docs/apis/ui/tab-bar/hideTabBarRedDot.md @@ -5,7 +5,7 @@ sidebar_label: hideTabBarRedDot 隐藏 tabBar 某一项的右上角的红点 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html) diff --git a/docs/apis/ui/tab-bar/removeTabBarBadge.md b/docs/apis/ui/tab-bar/removeTabBarBadge.md index d2b2a511a5ec..c53a609bedbe 100644 --- a/docs/apis/ui/tab-bar/removeTabBarBadge.md +++ b/docs/apis/ui/tab-bar/removeTabBarBadge.md @@ -5,7 +5,7 @@ sidebar_label: removeTabBarBadge 移除 tabBar 某一项右上角的文本 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html) diff --git a/docs/apis/ui/tab-bar/setTabBarBadge.md b/docs/apis/ui/tab-bar/setTabBarBadge.md index 42e6a987897d..7657d46f1a20 100644 --- a/docs/apis/ui/tab-bar/setTabBarBadge.md +++ b/docs/apis/ui/tab-bar/setTabBarBadge.md @@ -5,7 +5,7 @@ sidebar_label: setTabBarBadge 为 tabBar 某一项的右上角添加文本 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarBadge.html) diff --git a/docs/apis/ui/tab-bar/setTabBarItem.md b/docs/apis/ui/tab-bar/setTabBarItem.md index 220a6fe129f1..f6468184a7d2 100644 --- a/docs/apis/ui/tab-bar/setTabBarItem.md +++ b/docs/apis/ui/tab-bar/setTabBarItem.md @@ -5,7 +5,7 @@ sidebar_label: setTabBarItem 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarItem.html) diff --git a/docs/apis/ui/tab-bar/showTabBar.md b/docs/apis/ui/tab-bar/showTabBar.md index 924986a4e527..471a9d0ab7a6 100644 --- a/docs/apis/ui/tab-bar/showTabBar.md +++ b/docs/apis/ui/tab-bar/showTabBar.md @@ -5,7 +5,7 @@ sidebar_label: showTabBar 显示 tabBar -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html) diff --git a/docs/apis/ui/tab-bar/showTabBarRedDot.md b/docs/apis/ui/tab-bar/showTabBarRedDot.md index 508dcd472fbb..c557074d71f3 100644 --- a/docs/apis/ui/tab-bar/showTabBarRedDot.md +++ b/docs/apis/ui/tab-bar/showTabBarRedDot.md @@ -5,7 +5,7 @@ sidebar_label: showTabBarRedDot 显示 tabBar 某一项的右上角的红点 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html) diff --git a/docs/apis/wxml/IntersectionObserver.md b/docs/apis/wxml/IntersectionObserver.md index 18da2ff9af4b..42f750190b1f 100644 --- a/docs/apis/wxml/IntersectionObserver.md +++ b/docs/apis/wxml/IntersectionObserver.md @@ -102,13 +102,14 @@ Taro.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.ta ### ObserveCallbackResult -| 参数 | 类型 | 说明 | -| --- | --- | --- | -| boundingClientRect | `BoundingClientRectResult` | 目标边界 | -| intersectionRatio | `number` | 相交比例 | -| intersectionRect | `IntersectionRectResult` | 相交区域的边界 | -| relativeRect | `RelativeRectResult` | 参照区域的边界 | -| time | `number` | 相交检测时的时间戳 | +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| errMsg | `string` | 否 | 错误信息,会在找不到对应元素时返回
API 支持度: harmony | +| boundingClientRect | `BoundingClientRectResult` | 否 | 目标边界 | +| intersectionRatio | `number` | 否 | 相交比例 | +| intersectionRect | `IntersectionRectResult` | 否 | 相交区域的边界 | +| relativeRect | `RelativeRectResult` | 否 | 参照区域的边界 | +| time | `number` | 否 | 相交检测时的时间戳 | ### RelativeRectResult diff --git a/docs/apis/wxml/createIntersectionObserver.md b/docs/apis/wxml/createIntersectionObserver.md index fa34f33cacdd..e16f0340c81e 100644 --- a/docs/apis/wxml/createIntersectionObserver.md +++ b/docs/apis/wxml/createIntersectionObserver.md @@ -5,7 +5,7 @@ sidebar_label: createIntersectionObserver 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createIntersectionObserver.html) diff --git a/docs/apis/wxml/createSelectorQuery.md b/docs/apis/wxml/createSelectorQuery.md index 10d8e9e143d9..78a7fac475af 100644 --- a/docs/apis/wxml/createSelectorQuery.md +++ b/docs/apis/wxml/createSelectorQuery.md @@ -5,7 +5,7 @@ sidebar_label: createSelectorQuery 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) diff --git a/docs/components/base/icon.md b/docs/components/base/icon.md index 2aca96db67e2..8463df78f331 100755 --- a/docs/components/base/icon.md +++ b/docs/components/base/icon.md @@ -77,7 +77,7 @@ export default class PageView extends Component { | 参数 | 类型 | 默认值 | 必填 | 说明 | | --- | --- | :---: | :---: | --- | | type | `keyof TIconType` | | 是 | icon 的类型 | -| size | `string` | `23` | 否 | icon 的大小,单位px | +| size | `number` | `23` | 否 | icon 的大小,单位px | | color | `string` | | 否 | icon 的颜色,同 css 的 color | | ariaLabel | `string` | | 否 | 无障碍访问,(属性)元素的额外描述 | @@ -85,9 +85,9 @@ export default class PageView extends Component { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| IconProps.type | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| IconProps.type | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | IconProps.size | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| IconProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| IconProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | IconProps.ariaLabel | | | | | ✔️ | | | | | | ### TIconType diff --git a/docs/components/base/progress.md b/docs/components/base/progress.md index 5c3a46eecd3a..6d3f87724c46 100755 --- a/docs/components/base/progress.md +++ b/docs/components/base/progress.md @@ -5,7 +5,7 @@ sidebar_label: Progress 进度条。组件属性的长度单位默认为 px -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/progress.html) diff --git a/docs/components/base/rich-text.md b/docs/components/base/rich-text.md index 059b11c96fa3..a5d21b5b9afb 100755 --- a/docs/components/base/rich-text.md +++ b/docs/components/base/rich-text.md @@ -5,7 +5,7 @@ sidebar_label: RichText 富文本 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html) @@ -101,23 +101,25 @@ export default { | onTouchcancel | `CommonEventFunction` | | 否 | 触摸动作被打断。 | | onTouchend | `CommonEventFunction` | | 否 | 触摸动作结束。 | | onLongtap | `CommonEventFunction` | | 否 | 触摸后,超过 500ms 再离开。 | +| mode | "default" or "compat" or "aggressive" or "inline-block" or "web" | `default` | 否 | 布局兼容模式 | ### API 支持度 -| API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | H5 | React Native | Harmony | Harmony hybrid | -| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| RichTextProps.userSelect | ✔️ | | | | | ✔️ | | | ✔️ | -| RichTextProps.nodes | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | -| RichTextProps.space | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| RichTextProps.selectable | | ✔️ | | | | ✔️ | | | ✔️ | -| RichTextProps.imageMenuPrevent | | ✔️ | | | | | | | | -| RichTextProps.preview | | ✔️ | | | | | | | | -| RichTextProps.onTap | | | ✔️ | | | | | | | -| RichTextProps.onTouchstart | | | ✔️ | | | | | | | -| RichTextProps.onTouchmove | | | ✔️ | | | | | | | -| RichTextProps.onTouchcancel | | | ✔️ | | | | | | | -| RichTextProps.onTouchend | | | ✔️ | | | | | | | -| RichTextProps.onLongtap | | | ✔️ | | | | | | | +| API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | +| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | +| RichTextProps.userSelect | ✔️ | | | | | ✔️ | ✔️ | | | ✔️ | +| RichTextProps.nodes | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| RichTextProps.space | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| RichTextProps.selectable | | ✔️ | | | | | ✔️ | | | ✔️ | +| RichTextProps.imageMenuPrevent | | ✔️ | | | | | | | | | +| RichTextProps.preview | | ✔️ | | | | | | | | | +| RichTextProps.onTap | | | ✔️ | | | | | | | | +| RichTextProps.onTouchstart | | | ✔️ | | | | | | | | +| RichTextProps.onTouchmove | | | ✔️ | | | | | | | | +| RichTextProps.onTouchcancel | | | ✔️ | | | | | | | | +| RichTextProps.onTouchend | | | ✔️ | | | | | | | | +| RichTextProps.onLongtap | | | ✔️ | | | | | | | | +| RichTextProps.mode | ✔️ | | | | | | | | | | ### TSpace diff --git a/docs/components/base/text.md b/docs/components/base/text.md index bdeaa7959323..f15ee3e6de5e 100755 --- a/docs/components/base/text.md +++ b/docs/components/base/text.md @@ -5,7 +5,7 @@ sidebar_label: Text 文本 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/text.html) @@ -131,8 +131,8 @@ export default { | TextProps.space | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | | TextProps.decode | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | (默认解码,不支持设置) | | | | | TextProps.numberOfLines | | | ✔️ | | | | | | | | -| TextProps.overflow | | | | | | | | | | | -| TextProps.maxLines | ✔️ | | | | | | | | | | +| TextProps.overflow | ✔️ | | | | | | | | | | +| TextProps.maxLines | ✔️ | | | | | | | | ✔️ | | ### TSpace diff --git a/docs/components/forms/button.md b/docs/components/forms/button.md index c70f2b41d4a1..bbd6f28553c5 100755 --- a/docs/components/forms/button.md +++ b/docs/components/forms/button.md @@ -242,11 +242,11 @@ export default { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | ButtonProps.size | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ButtonProps.type | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ButtonProps.plain | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ButtonProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ButtonProps.loading | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ButtonProps.formType | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | +| ButtonProps.type | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| ButtonProps.plain | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| ButtonProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| ButtonProps.loading | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| ButtonProps.formType | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | | | ButtonProps.openType | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | | ButtonProps.hoverClass | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(支持 hoverStyle 属性,但框架未支持 hoverClass) | | ✔️ | | ButtonProps.hoverStyle | | | | | | | | ✔️ | | | diff --git a/docs/components/forms/checkbox.md b/docs/components/forms/checkbox.md index 4a525b4d334b..89dd3852b499 100755 --- a/docs/components/forms/checkbox.md +++ b/docs/components/forms/checkbox.md @@ -166,11 +166,11 @@ export default { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| CheckboxProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| CheckboxProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| CheckboxProps.checked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| CheckboxProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| CheckboxProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| CheckboxProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| CheckboxProps.checked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| CheckboxProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | CheckboxProps.name | | | | | | | ✔️ | | ✔️ | ✔️ | | CheckboxProps.nativeProps | | | | | | | ✔️ | | | ✔️ | | CheckboxProps.ariaLabel | | | | | ✔️ | | | | | | -| CheckboxProps.onChange | | | ✔️ | | | | ✔️ | ✔️ | | ✔️ | +| CheckboxProps.onChange | | | ✔️ | | | | ✔️ | ✔️ | ✔️ | ✔️ | diff --git a/docs/components/forms/editor.md b/docs/components/forms/editor.md index 794577350ffe..07272d0d290f 100644 --- a/docs/components/forms/editor.md +++ b/docs/components/forms/editor.md @@ -15,7 +15,7 @@ sidebar_label: Editor *编辑器内支持部分 HTML 标签和内联样式,不支持 **class** 和 **id*** -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/editor.html) @@ -114,17 +114,17 @@ class App extends Components { ### API 支持度 -| API | 微信小程序 | H5 | React Native | Harmony | -| :---: | :---: | :---: | :---: | :---: | -| EditorProps.readOnly | ✔️ | | | | -| EditorProps.placeholder | ✔️ | | | | -| EditorProps.showImgSize | ✔️ | | | | -| EditorProps.showImgToolbar | ✔️ | | | | -| EditorProps.showImgResize | ✔️ | | | | -| EditorProps.onReady | ✔️ | | | | -| EditorProps.onFocus | ✔️ | | | | -| EditorProps.onBlur | ✔️ | | | | -| EditorProps.onInput | ✔️ | | | | -| EditorProps.onStatusChange | ✔️ | | | | +| API | 微信小程序 | 京东小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | :---: | +| EditorProps.readOnly | ✔️ | ✔️ | | | | +| EditorProps.placeholder | ✔️ | ✔️ | | | | +| EditorProps.showImgSize | ✔️ | ✔️ | | | | +| EditorProps.showImgToolbar | ✔️ | ✔️ | | | | +| EditorProps.showImgResize | ✔️ | ✔️ | | | | +| EditorProps.onReady | ✔️ | ✔️ | | | | +| EditorProps.onFocus | ✔️ | ✔️ | | | | +| EditorProps.onBlur | ✔️ | ✔️ | | | | +| EditorProps.onInput | ✔️ | ✔️ | | | | +| EditorProps.onStatusChange | ✔️ | ✔️ | | | | ### editorEventDetail diff --git a/docs/components/forms/form.md b/docs/components/forms/form.md index f6ee840fda65..dedf4d076298 100755 --- a/docs/components/forms/form.md +++ b/docs/components/forms/form.md @@ -111,8 +111,8 @@ export default { | FormProps.subscribeId | | ✔️ | | | | | | | | | | FormProps.conversionTarget | | | | ✔️ | | | | | | | | FormProps.clueComponentId | | | | ✔️ | | | | | | | -| FormProps.onSubmit | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| FormProps.onReset | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| FormProps.onSubmit | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| FormProps.onReset | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### onSubmitEventDetail diff --git a/docs/components/forms/input.md b/docs/components/forms/input.md index 435d2da11a79..87110477deb5 100755 --- a/docs/components/forms/input.md +++ b/docs/components/forms/input.md @@ -96,6 +96,7 @@ class App extends Component { | confirmType | `keyof ConfirmType` | `done` | 否 | 设置键盘右下角按钮的文字,仅在type='text'时生效 | | confirmHold | `boolean` | `false` | 否 | 点击键盘右下角按钮时是否保持键盘不收起 | | cursor | `number` | | 否 | 指定focus时的光标位置 | +| cursorColor | `string` | | 否 | 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 | | selectionStart | `number` | `-1` | 否 | 光标起始位置,自动聚集时有效,需与selection-end搭配使用 | | selectionEnd | `number` | `-1` | 否 | 光标结束位置,自动聚集时有效,需与selection-start搭配使用 | | adjustPosition | `boolean` | `true` | 否 | 键盘弹起时,是否自动上推页面 | @@ -120,30 +121,36 @@ class App extends Component { | onConfirm | `CommonEventFunction` | | 否 | 点击完成按钮时触发 | | onKeyboardHeightChange | `CommonEventFunction` | | 否 | 键盘高度发生变化的时候触发此事件 | | onNickNameReview | `CommonEventFunction` | | 否 | 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效,event.detail = { pass, timeout } | +| onSelectionChange | `CommonEventFunction` | | 否 | 选区改变事件, {selectionStart, selectionEnd} | +| onKeyboardCompositionStart | `CommonEventFunction` | | 否 | 输入法开始新的输入时触发 (仅当输入法支持时触发) | +| onKeyboardCompositionUpdate | `CommonEventFunction` | | 否 | 输入法输入字符时触发(仅当输入法支持时触发) | +| onKeyboardCompositionEnd | `CommonEventFunction` | | 否 | 输入法输入结束时触发(仅当输入法支持时触发) | +| onKeyoardHeightChangeWorklet | `string` | | 否 | 键盘高度变化时触发。event.detail = {height: height, pageBottomPadding: pageBottomPadding}; height: 键盘高度,pageBottomPadding: 页面上推高度 | ### API 支持度 | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| InputProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| InputProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | InputProps.defaultValue | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.type | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.password | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.placeholder | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.placeholderStyle | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | +| InputProps.type | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.password | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.placeholder | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.placeholderStyle | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | | InputProps.placeholderClass | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | -| InputProps.placeholderTextColor | | | | | | | | ✔️ | | | +| InputProps.placeholderTextColor | | | | | | | | ✔️ | ✔️ | | | InputProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.maxlength | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| InputProps.maxlength | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | InputProps.cursorSpacing | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | | | | | InputProps.autoFocus | ✔️ | | | | ✔️ | ✔️ | ✔️ | | | ✔️ | | InputProps.focus | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.confirmType | ✔️ | ✔️ | ✔️(confirm-type 与 enableNative 属性冲突,若希望 confirm-type 生效,enableNative 不能设定为 false,而且不能设定 always-system) | ✔️ | ✔️ | ✔️ | | ✔️ | | | +| InputProps.confirmType | ✔️ | ✔️ | ✔️(confirm-type 与 enableNative 属性冲突,若希望 confirm-type 生效,enableNative 不能设定为 false,而且不能设定 always-system) | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | | InputProps.confirmHold | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | -| InputProps.cursor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | +| InputProps.cursor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | +| InputProps.cursorColor | ✔️ | | | | | | | | | | | InputProps.selectionStart | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | | InputProps.selectionEnd | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | -| InputProps.adjustPosition | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | | | | +| InputProps.adjustPosition | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | | ✔️ | | | InputProps.holdKeyboard | ✔️ | | | ✔️ | | | | | | | | InputProps.alwaysEmbed | ✔️ | | | | | | | | | | | InputProps.safePasswordCertPath | ✔️ | | | | | | | | | | @@ -159,12 +166,17 @@ class App extends Component { | InputProps.alwaysSystem | | | ✔️ | | | | | | | | | InputProps.ariaLabel | | | | | ✔️ | | | | | | | InputProps.clueType | | | | ✔️ | | | | | | | -| InputProps.onInput | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.onFocus | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.onBlur | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.onConfirm | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| InputProps.onKeyboardHeightChange | ✔️ | | | ✔️ | ✔️ | | | | | | +| InputProps.onInput | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.onFocus | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.onBlur | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.onConfirm | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| InputProps.onKeyboardHeightChange | ✔️ | | | ✔️ | ✔️ | | | | ✔️ | | | InputProps.onNickNameReview | ✔️ | | | | | | | | | | +| InputProps.onSelectionChange | ✔️ | | | | | | | | | | +| InputProps.onKeyboardCompositionStart | ✔️ | | | | | | | | | | +| InputProps.onKeyboardCompositionUpdate | ✔️ | | | | | | | | | | +| InputProps.onKeyboardCompositionEnd | ✔️ | | | | | | | | | | +| InputProps.onKeyoardHeightChangeWorklet | ✔️ | | | | | | | | | | ### Type diff --git a/docs/components/forms/label.md b/docs/components/forms/label.md index 12cb47d95d7b..6ee6f01a40f7 100755 --- a/docs/components/forms/label.md +++ b/docs/components/forms/label.md @@ -77,4 +77,4 @@ class App extends Components { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| LabelProps.for | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | +| LabelProps.for | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | diff --git a/docs/components/forms/picker-view-column.md b/docs/components/forms/picker-view-column.md index 22f5a47cd8f5..db4f157f4b18 100644 --- a/docs/components/forms/picker-view-column.md +++ b/docs/components/forms/picker-view-column.md @@ -6,7 +6,7 @@ sidebar_label: PickerViewColumn 滚动选择器子项 仅可放置于 `` 中,其孩子节点的高度会自动设置成与 picker-view 的选中框的高度一致 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/picker-view-column.html) diff --git a/docs/components/forms/picker-view.md b/docs/components/forms/picker-view.md index 2351b3e29472..2eaa66035298 100755 --- a/docs/components/forms/picker-view.md +++ b/docs/components/forms/picker-view.md @@ -6,7 +6,7 @@ sidebar_label: PickerView 嵌入页面的滚动选择器 其中只可放置 picker-view-column 组件,其它节点不会显示 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/picker-view.html) diff --git a/docs/components/forms/picker.md b/docs/components/forms/picker.md index c58f395b0ea0..f78c6fbb7b0a 100755 --- a/docs/components/forms/picker.md +++ b/docs/components/forms/picker.md @@ -170,15 +170,17 @@ export default class PagePicker extends Component { | mode | `keyof Mode` | `"selector"` | 否 | 选择器类型,默认是普通选择器 | | disabled | `boolean` | `false` | 否 | 是否禁用 | | onCancel | `CommonEventFunction` | | 否 | 取消选择或点遮罩层收起 picker 时触发 | +| textProps | `PickerText` | | 否 | 用于替换组件内部文本 | ### API 支持度 | API | 微信小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | | PickerStandardProps.headerText | ✔️ | | | | | -| PickerStandardProps.mode | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerStandardProps.mode | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | PickerStandardProps.disabled | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerStandardProps.onCancel | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerStandardProps.onCancel | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerStandardProps.textProps | | ✔️ | | ✔️ | ✔️ | ### Mode @@ -213,20 +215,18 @@ export default class PagePicker extends Component { | itemStyle | `StyleProp` | `{}` | 否 | mode为 selector 或 multiSelector 时 itemStyle 有效 | | indicatorStyle | `StyleProp` | `{}` | 否 | mode为 selector 或 multiSelector 时 indicatorStyle 有效 | | onChange | `CommonEventFunction` | | 否 | value 改变时触发 change 事件 | -| textProps | `PickerText` | | 否 | 用于替换组件内部文本 | ### API 支持度 | API | 微信小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | -| PickerSelectorProps.range | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerSelectorProps.rangeKey | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerSelectorProps.value | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerSelectorProps.range | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerSelectorProps.rangeKey | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerSelectorProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | PickerSelectorProps.defaultValue | ✔️ | ✔️ | ✔️ | | ✔️ | | PickerSelectorProps.itemStyle | | | ✔️ | | | | PickerSelectorProps.indicatorStyle | | | ✔️ | | | -| PickerSelectorProps.onChange | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerSelectorProps.textProps | | ✔️ | | | ✔️ | +| PickerSelectorProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### ChangeEventDetail @@ -253,13 +253,13 @@ export default class PagePicker extends Component { | API | 微信小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | -| PickerMultiSelectorProps.range | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerMultiSelectorProps.rangeKey | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerMultiSelectorProps.value | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerMultiSelectorProps.range | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerMultiSelectorProps.rangeKey | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerMultiSelectorProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | PickerMultiSelectorProps.itemStyle | | | ✔️ | | | | PickerMultiSelectorProps.indicatorStyle | | | ✔️ | | | -| PickerMultiSelectorProps.onChange | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerMultiSelectorProps.onColumnChange | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerMultiSelectorProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerMultiSelectorProps.onColumnChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### ChangeEventDetail @@ -291,11 +291,11 @@ export default class PagePicker extends Component { | API | 微信小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | -| PickerTimeProps.value | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerTimeProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | PickerTimeProps.defaultValue | ✔️ | ✔️ | ✔️ | | | -| PickerTimeProps.start | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerTimeProps.end | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerTimeProps.onChange | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerTimeProps.start | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerTimeProps.end | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerTimeProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### ChangeEventDetail @@ -321,12 +321,12 @@ export default class PagePicker extends Component { | API | 微信小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | -| PickerDateProps.value | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerDateProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | PickerDateProps.defaultValue | ✔️ | ✔️ | ✔️ | | | -| PickerDateProps.start | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerDateProps.end | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerDateProps.start | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| PickerDateProps.end | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | PickerDateProps.fields | ✔️ | ✔️ | ✔️ | | ✔️ | -| PickerDateProps.onChange | ✔️ | ✔️ | ✔️ | | ✔️ | +| PickerDateProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### Fields @@ -382,6 +382,7 @@ export default class PagePicker extends Component { | value | `string` | 是 | | code | `string` | 是 | | postcode | `string` | 否 | +| children | `RegionData[]` | 否 | ### Level diff --git a/docs/components/forms/radio-group.md b/docs/components/forms/radio-group.md index 53f012488896..ad608f1cf09e 100644 --- a/docs/components/forms/radio-group.md +++ b/docs/components/forms/radio-group.md @@ -26,7 +26,7 @@ ComponentType | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| RadioGroupProps.name | | | ✔️ | ✔️ | | | | | | | +| RadioGroupProps.name | | | ✔️ | ✔️ | | | | | ✔️ | | | RadioGroupProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | ### onChangeEventDetail diff --git a/docs/components/forms/radio.md b/docs/components/forms/radio.md index 867a478c85a5..2512f1df9831 100755 --- a/docs/components/forms/radio.md +++ b/docs/components/forms/radio.md @@ -185,11 +185,11 @@ export default { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| RadioProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| RadioProps.checked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| RadioProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| RadioProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | +| RadioProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| RadioProps.checked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| RadioProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| RadioProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | | RadioProps.name | | | | | | | ✔️ | | ✔️ | ✔️ | | RadioProps.nativeProps | | | | | | | ✔️ | | | ✔️ | | RadioProps.ariaLabel | | | | | ✔️ | | | | | | -| RadioProps.onChange | | | | | | | ✔️ | ✔️ | | ✔️ | +| RadioProps.onChange | | | | | | | ✔️ | ✔️ | ✔️ | ✔️ | diff --git a/docs/components/forms/slider.md b/docs/components/forms/slider.md index 563a89a4144c..2273f3fe8d41 100755 --- a/docs/components/forms/slider.md +++ b/docs/components/forms/slider.md @@ -93,25 +93,25 @@ export default class PageView extends Component { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| SliderProps.min | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.max | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.step | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SliderProps.min | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.max | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.step | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SliderProps.defaultValue | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.color | ✔️ | | | ✔️ | ✔️ | ✔️ | | | | | -| SliderProps.selectedColor | ✔️ | | | ✔️ | ✔️ | ✔️ | | | | | -| SliderProps.activeColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.backgroundColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.blockSize | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | -| SliderProps.blockColor | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.showValue | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SliderProps.color | ✔️ | | | ✔️ | ✔️ | ✔️ | | | ✔️ | | +| SliderProps.selectedColor | ✔️ | | | ✔️ | ✔️ | ✔️ | | | ✔️ | | +| SliderProps.activeColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.backgroundColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.blockSize | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | +| SliderProps.blockColor | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.showValue | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SliderProps.name | | | ✔️ | | | | | | | | | SliderProps.trackSize | | | ✔️ | | | | | | | | | SliderProps.handleSize | | | ✔️ | | | | | | | | | SliderProps.handleColor | | | ✔️ | | | | | | | | | SliderProps.ariaLabel | | | | | ✔️ | | | | | | -| SliderProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SliderProps.onChanging | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SliderProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SliderProps.onChanging | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### onChangeEventDetail diff --git a/docs/components/forms/switch.md b/docs/components/forms/switch.md index e2c92947017d..18863b5f7e89 100755 --- a/docs/components/forms/switch.md +++ b/docs/components/forms/switch.md @@ -83,16 +83,16 @@ export default class PageView extends Component { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| SwitchProps.checked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwitchProps.checked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SwitchProps.defaultChecked | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwitchProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | ✔️ | -| SwitchProps.type | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwitchProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwitchProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | +| SwitchProps.type | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SwitchProps.color | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SwitchProps.nativeProps | | | | | | | ✔️ | | | ✔️ | | SwitchProps.name | | | ✔️ | | | | | | | | | SwitchProps.controlled | | | ✔️ | | | | | | | | | SwitchProps.ariaLabel | | | | | ✔️ | | | | | | -| SwitchProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwitchProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ### onChangeEventDetail diff --git a/docs/components/forms/textarea.md b/docs/components/forms/textarea.md index e080e2a4b7a7..f90baaa676f3 100755 --- a/docs/components/forms/textarea.md +++ b/docs/components/forms/textarea.md @@ -67,7 +67,7 @@ export default class PageView extends Component { | value | `string` | | 否 | 输入框的内容 | | defaultValue | `string` | | 否 | 设置 React 非受控输入框的初始内容 | | placeholder | `string` | | 否 | 输入框为空时占位符 | -| placeholderStyle | `string` | | 否 | 指定 placeholder 的样式 | +| placeholderStyle | `string` | | 否 | 指定 placeholder 的样式
需传入对象,格式为 { fontSize: number, fontWeight: string, color: string } | | placeholderClass | `string` | `"textarea-placeholder"` | 否 | 指定 placeholder 的样式类 | | disabled | `boolean` | `false` | 否 | 是否禁用 | | maxlength | `number` | `140` | 否 | 最大输入长度,设置为 -1 的时候不限制最大长度 | @@ -97,15 +97,19 @@ export default class PageView extends Component { | onInput | `CommonEventFunction` | | 否 | 当键盘输入时,触发 input 事件

**onInput 处理函数的返回值并不会反映到 textarea 上** | | onConfirm | `CommonEventFunction` | | 否 | 点击完成时, 触发 confirm 事件 | | onKeyboardHeightChange | `CommonEventFunction` | | 否 | 键盘高度发生变化的时候触发此事件 | +| onSelectionChange | `CommonEventFunction` | | 否 | 选区改变事件, {selectionStart, selectionEnd} | +| onKeyboardCompositionStart | `CommonEventFunction` | | 否 | 输入法开始新的输入时触发 (仅当输入法支持时触发) | +| onKeyboardCompositionUpdate | `CommonEventFunction` | | 否 | 输入法输入字符时触发(仅当输入法支持时触发) | +| onKeyboardCompositionEnd | `CommonEventFunction` | | 否 | 输入法输入结束时触发(仅当输入法支持时触发) | ### API 支持度 | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| TextareaProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| TextareaProps.value | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | TextareaProps.defaultValue | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| TextareaProps.placeholder | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| TextareaProps.placeholderStyle | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | +| TextareaProps.placeholder | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| TextareaProps.placeholderStyle | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | | | TextareaProps.placeholderClass | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | | TextareaProps.disabled | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | TextareaProps.maxlength | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | @@ -129,12 +133,16 @@ export default class PageView extends Component { | TextareaProps.controlled | | | ✔️ | | | | | | | | | TextareaProps.ariaLabel | | | | | ✔️ | | | | | | | TextareaProps.adjustKeyboardTo | ✔️ | | | | | | | | | | -| TextareaProps.onFocus | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| TextareaProps.onBlur | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| TextareaProps.onFocus | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| TextareaProps.onBlur | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | TextareaProps.onLineChange | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | ✔️ | | | -| TextareaProps.onInput | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| TextareaProps.onInput | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | TextareaProps.onConfirm | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| TextareaProps.onKeyboardHeightChange | ✔️ | | | ✔️ | | | | | | | +| TextareaProps.onKeyboardHeightChange | ✔️ | | | ✔️ | | | | | ✔️ | | +| TextareaProps.onSelectionChange | ✔️ | | | | | | | | | | +| TextareaProps.onKeyboardCompositionStart | ✔️ | | | | | | | | | | +| TextareaProps.onKeyboardCompositionUpdate | ✔️ | | | | | | | | | | +| TextareaProps.onKeyboardCompositionEnd | ✔️ | | | | | | | | | | ### onFocusEventDetail diff --git a/docs/components/gesture/double-tap-gesture-handler.md b/docs/components/gesture/double-tap-gesture-handler.md new file mode 100644 index 000000000000..c4c65ab36d90 --- /dev/null +++ b/docs/components/gesture/double-tap-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: DoubleTapGestureHandler +sidebar_label: DoubleTapGestureHandler +--- + +双击时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, DoubleTapGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## DoubleTapGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| DoubleTapGestureHandlerProps.tag | ✔️ | | | | +| DoubleTapGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| DoubleTapGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| DoubleTapGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| DoubleTapGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| DoubleTapGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/force-press-gesture-handler.md b/docs/components/gesture/force-press-gesture-handler.md new file mode 100644 index 000000000000..e2025a316dfa --- /dev/null +++ b/docs/components/gesture/force-press-gesture-handler.md @@ -0,0 +1,63 @@ +--- +title: ForcePressGestureHandler +sidebar_label: ForcePressGestureHandler +--- + +iPhone 设备重按时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, ForcePressGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## ForcePressGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| ForcePressGestureHandlerProps.tag | ✔️ | | | | +| ForcePressGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| ForcePressGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| ForcePressGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| ForcePressGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/horizontal-drag-gesture-handler.md b/docs/components/gesture/horizontal-drag-gesture-handler.md new file mode 100644 index 000000000000..058cf4e786bf --- /dev/null +++ b/docs/components/gesture/horizontal-drag-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: HorizontalDragGestureHandler +sidebar_label: HorizontalDragGestureHandler +--- + +横向滑动时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, HorizontalDragGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## HorizontalDragGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| HorizontalDragGestureHandlerProps.tag | ✔️ | | | | +| HorizontalDragGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| HorizontalDragGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| HorizontalDragGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| HorizontalDragGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| HorizontalDragGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/long-press-gesture-handler.md b/docs/components/gesture/long-press-gesture-handler.md new file mode 100644 index 000000000000..3e7a001e3534 --- /dev/null +++ b/docs/components/gesture/long-press-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: LongPressGestureHandler +sidebar_label: LongPressGestureHandler +--- + +长按时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, LongPressGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## LongPressGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| LongPressGestureHandlerProps.tag | ✔️ | | | | +| LongPressGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| LongPressGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| LongPressGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| LongPressGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| LongPressGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/pan-gesture-handler.md b/docs/components/gesture/pan-gesture-handler.md new file mode 100644 index 000000000000..646b46075933 --- /dev/null +++ b/docs/components/gesture/pan-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: PanGestureHandler +sidebar_label: PanGestureHandler +--- + +拖动(横向/纵向)时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, PanGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## PanGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| PanGestureHandlerProps.tag | ✔️ | | | | +| PanGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| PanGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| PanGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| PanGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| PanGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/scale-gesture-handler.md b/docs/components/gesture/scale-gesture-handler.md new file mode 100644 index 000000000000..b51b6584ff24 --- /dev/null +++ b/docs/components/gesture/scale-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: ScaleGestureHandler +sidebar_label: ScaleGestureHandler +--- + +多指缩放时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, ScaleGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## ScaleGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| ScaleGestureHandlerProps.tag | ✔️ | | | | +| ScaleGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| ScaleGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| ScaleGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| ScaleGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| ScaleGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/tap-gesture-handler.md b/docs/components/gesture/tap-gesture-handler.md new file mode 100644 index 000000000000..538ae6ef1836 --- /dev/null +++ b/docs/components/gesture/tap-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: TapGestureHandler +sidebar_label: TapGestureHandler +--- + +点击时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, TapGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## TapGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| TapGestureHandlerProps.tag | ✔️ | | | | +| TapGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| TapGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| TapGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| TapGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| TapGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/gesture/vertical-drag-gesture-handler.md b/docs/components/gesture/vertical-drag-gesture-handler.md new file mode 100644 index 000000000000..9914e443aa9c --- /dev/null +++ b/docs/components/gesture/vertical-drag-gesture-handler.md @@ -0,0 +1,65 @@ +--- +title: VerticalDragGestureHandler +sidebar_label: VerticalDragGestureHandler +--- + +纵向滑动时触发手势 +微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + +支持情况: + +## 类型 + +```tsx +ComponentType +``` + +## 示例代码 + +import { ReactIcon, VueIcon } from '@site/static/icons' +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +, value: "React" }]}> + + +```tsx +import { Component } from 'react' +import { View, VerticalDragGestureHandler } from '@tarojs/components' + +export function Index () { + return ( + + + + + + ) +} +``` + + + +## VerticalDragGestureHandlerProps + +| 参数 | 类型 | 必填 | 说明 | +| --- | --- | :---: | --- | +| tag | `string` | 否 | 声明手势协商时的组件标识 | +| onGestureWorklet | `string` | 否 | 手势识别成功的回调 | +| shouldResponseOnMoveWorklet | `string` | 否 | 手指移动过程中手势是否响应 | +| shouldAcceptGestureWorklet | `string` | 否 | 手势是否应该被识别 | +| simultaneousHandlers | `string[]` | 否 | 声明可同时触发的手势节点 | +| nativeView | `string` | 否 | 代理的原生节点类型 | + +### API 支持度 + +| API | 微信小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | +| VerticalDragGestureHandlerProps.tag | ✔️ | | | | +| VerticalDragGestureHandlerProps.onGestureWorklet | ✔️ | | | | +| VerticalDragGestureHandlerProps.shouldResponseOnMoveWorklet | ✔️ | | | | +| VerticalDragGestureHandlerProps.shouldAcceptGestureWorklet | ✔️ | | | | +| VerticalDragGestureHandlerProps.simultaneousHandlers | ✔️ | | | | +| VerticalDragGestureHandlerProps.nativeView | ✔️ | | | | diff --git a/docs/components/media/camera.md b/docs/components/media/camera.md index b38d2cbe6ac7..0f6dd3f94728 100755 --- a/docs/components/media/camera.md +++ b/docs/components/media/camera.md @@ -5,7 +5,7 @@ sidebar_label: Camera 系统相机 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) diff --git a/docs/components/media/image.md b/docs/components/media/image.md index b3295f6d0154..228596bb55a0 100755 --- a/docs/components/media/image.md +++ b/docs/components/media/image.md @@ -97,8 +97,8 @@ export default class PageView extends Component { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| ImageProps.src | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ImageProps.mode | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(部分支持 scaleToFill, aspectFit, aspectFill, widthFix) | | ✔️ | +| ImageProps.src | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| ImageProps.mode | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(部分支持 scaleToFill, aspectFit, aspectFill, widthFix) | ✔️(部分支持 scaleToFill, aspectFit, aspectFill, widthFix, heightFix) | ✔️ | | ImageProps.webp | ✔️ | ✔️ | | | | | | | | | | ImageProps.svg | | | | | | | | ✔️ | | | | ImageProps.lazyLoad | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | ✔️ | diff --git a/docs/components/media/video.md b/docs/components/media/video.md index 18eb5077e7ac..b872c2ae4bcc 100755 --- a/docs/components/media/video.md +++ b/docs/components/media/video.md @@ -177,15 +177,15 @@ export default class PageView extends Component { | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| VideoProps.src | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.duration | ✔️ | | ✔️ | | ✔️ | | ✔️ | ✔️ | | ✔️ | -| VideoProps.controls | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| VideoProps.src | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.duration | ✔️ | | ✔️ | | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.controls | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | VideoProps.danmuList | ✔️ | ✔️ | | | ✔️ | | ✔️ | | | ✔️ | | VideoProps.danmuBtn | ✔️ | ✔️ | | | ✔️ | | ✔️ | | | ✔️ | | VideoProps.enableDanmu | ✔️ | ✔️ | | | ✔️ | | ✔️ | | | ✔️ | -| VideoProps.autoplay | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.loop | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.muted | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| VideoProps.autoplay | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.loop | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.muted | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | VideoProps.initialTime | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | VideoProps.pageGesture | ✔️ | ✔️ | | | ✔️ | | | | | | | VideoProps.direction | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | | | | @@ -194,7 +194,7 @@ export default class PageView extends Component { | VideoProps.showPlayBtn | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | ✔️ | | VideoProps.showCenterPlayBtn | ✔️ | ✔️ | ✔️ | | ✔️ | | ✔️ | ✔️ | | ✔️ | | VideoProps.enableProgressGesture | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | ✔️ | -| VideoProps.objectFit | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | +| VideoProps.objectFit | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | VideoProps.poster | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | VideoProps.showMuteBtn | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | | ✔️ | | VideoProps.title | ✔️ | ✔️ | | | ✔️ | | | | | | @@ -238,15 +238,15 @@ export default class PageView extends Component { | VideoProps.preferredPeakBitRate | ✔️ | | | | | | | | | | | VideoProps.isLive | ✔️ | | | | | | | | | | | VideoProps.definition | | | | ✔️ | | | | | | | -| VideoProps.onPlay | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.onPause | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.onEnded | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.onTimeUpdate | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.onFullscreenChange | | | ✔️ | | | | ✔️ | ✔️ | | ✔️ | +| VideoProps.onPlay | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.onPause | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.onEnded | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.onTimeUpdate | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| VideoProps.onFullscreenChange | | | ✔️ | | | | ✔️ | ✔️ | ✔️ | ✔️ | | VideoProps.onWaiting | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | | | | | VideoProps.onError | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| VideoProps.onProgress | ✔️ | | | ✔️ | ✔️ | | ✔️ | | | ✔️ | -| VideoProps.onLoadedMetaData | ✔️ | ✔️ | | ✔️ | | ✔️ | | ✔️ | | | +| VideoProps.onProgress | ✔️ | | | ✔️ | ✔️ | | ✔️ | | ✔️ | ✔️ | +| VideoProps.onLoadedMetaData | ✔️ | ✔️ | | ✔️ | | ✔️ | | ✔️ | ✔️ | | | VideoProps.onEnterPictureInPicture | ✔️ | | | | | | | | | | | VideoProps.onLeavePictureInPicture | ✔️ | | | | | | | | | | | VideoProps.onSeekComplete | ✔️ | | | ✔️ | | | | | | | @@ -269,8 +269,8 @@ export default class PageView extends Component { | VideoProps.onLeaveBackground | | | | ✔️ | | | | | | | | VideoProps.onLoadedData | | | | | | ✔️ | | | | | | VideoProps.onLoadStart | | | | | | ✔️ | | | | | -| VideoProps.onSeeked | | | | | | ✔️ | | | | | -| VideoProps.onSeeking | | | | | | ✔️ | | | | | +| VideoProps.onSeeked | | | | | | ✔️ | | | ✔️ | | +| VideoProps.onSeeking | | | | | | ✔️ | | | ✔️ | | | VideoProps.onAdLoad | | | | ✔️ | | | | | | | | VideoProps.onCastingUserSelect | ✔️ | | | | | | | | | | | VideoProps.onCastingStateChange | ✔️ | | | | | | | | | | diff --git a/docs/components/navig/navigation-bar.md b/docs/components/navig/navigation-bar.md index 2f4dd6a82810..f203cc905b69 100644 --- a/docs/components/navig/navigation-bar.md +++ b/docs/components/navig/navigation-bar.md @@ -36,9 +36,9 @@ ComponentType | API | 微信小程序 | H5 | React Native | Harmony | | :---: | :---: | :---: | :---: | :---: | -| NavigationBarProps.title | ✔️ | | | | -| NavigationBarProps.loading | ✔️ | | | | -| NavigationBarProps.frontColor | ✔️ | | | | -| NavigationBarProps.backgroundColor | ✔️ | | | | +| NavigationBarProps.title | ✔️ | | | ✔️ | +| NavigationBarProps.loading | ✔️ | | | ✔️ | +| NavigationBarProps.frontColor | ✔️ | | | ✔️ | +| NavigationBarProps.backgroundColor | ✔️ | | | ✔️ | | NavigationBarProps.colorAnimationDuration | ✔️ | | | | | NavigationBarProps.colorAnimationTimingFunc | ✔️ | | | | diff --git a/docs/components/navig/navigator.md b/docs/components/navig/navigator.md index 067d31853ff2..eaed65c66531 100755 --- a/docs/components/navig/navigator.md +++ b/docs/components/navig/navigator.md @@ -5,7 +5,7 @@ sidebar_label: Navigator 页面链接 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html) diff --git a/docs/components/page-meta.md b/docs/components/page-meta.md index 7a6732593785..0a075626c978 100644 --- a/docs/components/page-meta.md +++ b/docs/components/page-meta.md @@ -11,7 +11,7 @@ Taro v3.6.19 开始支持 开发者需要在页面配置里添加:`enablePageMeta: true` ::: -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/page-meta.html) @@ -94,14 +94,14 @@ function Index () { | API | 微信小程序 | 支付宝小程序 | H5 | React Native | Harmony | | :---: | :---: | :---: | :---: | :---: | :---: | | PageMetaProps.backgroundTextStyle | ✔️ | | | | | -| PageMetaProps.backgroundColor | ✔️ | ✔️ | | | | -| PageMetaProps.backgroundColorTop | ✔️ | ✔️ | | | | -| PageMetaProps.backgroundColorBottom | ✔️ | ✔️ | | | | -| PageMetaProps.scrollTop | ✔️ | ✔️ | | | | -| PageMetaProps.scrollDuration | ✔️ | ✔️ | | | | +| PageMetaProps.backgroundColor | ✔️ | ✔️ | | | ✔️ | +| PageMetaProps.backgroundColorTop | ✔️ | ✔️ | | | ✔️ | +| PageMetaProps.backgroundColorBottom | ✔️ | ✔️ | | | ✔️ | +| PageMetaProps.scrollTop | ✔️ | ✔️ | | | ✔️ | +| PageMetaProps.scrollDuration | ✔️ | ✔️ | | | ✔️ | | PageMetaProps.pageStyle | ✔️ | ✔️ | | | | | PageMetaProps.rootFontSize | ✔️ | ✔️ | | | | -| PageMetaProps.rootBackgroundColor | ✔️ | ✔️ | | | | +| PageMetaProps.rootBackgroundColor | ✔️ | ✔️ | | | ✔️ | | PageMetaProps.pageFontSize | ✔️ | ✔️ | | | | | PageMetaProps.pageOrientation | ✔️ | | | | | | PageMetaProps.onResize | ✔️ | | | | | diff --git a/docs/components/skyline/draggable-sheet.md b/docs/components/skyline/draggable-sheet.md index 9f507ed21ba6..abf55b708ec8 100644 --- a/docs/components/skyline/draggable-sheet.md +++ b/docs/components/skyline/draggable-sheet.md @@ -27,6 +27,7 @@ ComponentType | maxChildSize | `number` | `1.0` | 否 | 最大时占父容器的比例 | | snap | `boolean` | `false` | 否 | 拖拽后是否自动对齐关键点 | | snapSizes | `any[]` | `[]` | 否 | 拖拽后对齐的关键点,无需包含最小和最大值 | +| onSizeUpdateWorklet | `string` | | 否 | 尺寸发生变化时触发,仅支持 worklet 作为回调。event = {pixels, size} | ### API 支持度 @@ -37,3 +38,4 @@ ComponentType | DraggableSheetProps.maxChildSize | ✔️ | | | | | DraggableSheetProps.snap | ✔️ | | | | | DraggableSheetProps.snapSizes | ✔️ | | | | +| DraggableSheetProps.onSizeUpdateWorklet | ✔️ | | | | diff --git a/docs/components/skyline/list-view.md b/docs/components/skyline/list-view.md index 0f724dae8a3e..0901161fc57a 100644 --- a/docs/components/skyline/list-view.md +++ b/docs/components/skyline/list-view.md @@ -5,7 +5,7 @@ sidebar_label: ListView 列表布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/list-view.html) diff --git a/docs/components/skyline/share-element.md b/docs/components/skyline/share-element.md index e130ddf1a29d..31909a853008 100644 --- a/docs/components/skyline/share-element.md +++ b/docs/components/skyline/share-element.md @@ -237,8 +237,8 @@ button { | transitionOnGesture | `boolean` | `false` | 否 | 手势返回时是否进行动画 | | shuttleOnPush | "from" or "to" | `"to"` | 否 | 指定 push 阶段的飞跃物 | | shuttleOnPop | `string` | `"to"` | 否 | 指定 pop 阶段的飞跃物 | -| rectTweenType | "materialRectArc" or "materialRectCenterArc" or "linear" or "elasticIn" or "elasticOut" or "elasticInOut" or "bounceIn" or "bounceOut" or "bounceInOut" or "cubic-bezier(x1," | `"materialRectArc"` | 否 | 动画插值曲线 | -| onFrame | `string` | | 否 | 动画帧回调 | +| rectTweenType | "materialRectArc" or "materialRectCenterArc" or "linear" or "elasticIn" or "elasticOut" or "elasticInOut" or "bounceIn" or "bounceOut" or "bounceInOut" or "cubic-bezier(x1, y1, x2, y2)" | `"materialRectArc"` | 否 | 动画插值曲线 | +| onFrameWorklet | `string` | | 否 | 动画帧回调 | ### API 支持度 @@ -254,4 +254,4 @@ button { | ShareElementProps.shuttleOnPush | ✔️ | | | | | | ShareElementProps.shuttleOnPop | ✔️ | | | | | | ShareElementProps.rectTweenType | ✔️ | | | | | -| ShareElementProps.onFrame | ✔️ | | | | | +| ShareElementProps.onFrameWorklet | ✔️ | | | | | diff --git a/docs/components/skyline/sticky-header.md b/docs/components/skyline/sticky-header.md index 352ae5ef161e..4dec62e1db11 100644 --- a/docs/components/skyline/sticky-header.md +++ b/docs/components/skyline/sticky-header.md @@ -5,7 +5,7 @@ sidebar_label: StickyHeader 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/sticky-header.html) @@ -21,6 +21,7 @@ ComponentType | --- | --- | :---: | :---: | --- | | offsetTop | `number` | `0` | 否 | 吸顶时与顶部的距(px) | | padding | `[number, number, number, number]` | `[0, 0, 0, 0]` | 否 | 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距 | +| onStickOnTopChange | `CommonEventFunction` | | 否 | 吸顶状态变化事件,仅支持非 worklet 的组件方法作为回调。event.detail = { isStickOnTop },当 sticky-header 吸顶时为 true,否则为 false。
version: >=3.6.2 | ### API 支持度 @@ -28,3 +29,4 @@ ComponentType | :---: | :---: | :---: | :---: | :---: | | StickyHeaderProps.offsetTop | ✔️ | | | | | StickyHeaderProps.padding | ✔️ | | | | +| StickyHeaderProps.onStickOnTopChange | ✔️ | | | | diff --git a/docs/components/skyline/sticky-section.md b/docs/components/skyline/sticky-section.md index e516acbd2012..1875c7a54019 100644 --- a/docs/components/skyline/sticky-section.md +++ b/docs/components/skyline/sticky-section.md @@ -5,7 +5,7 @@ sidebar_label: StickySection 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点。仅 Skyline 支持。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/sticky-section.html) diff --git a/docs/components/viewContainer/cover-image.md b/docs/components/viewContainer/cover-image.md index 58afbc97f4e6..34129de745f4 100644 --- a/docs/components/viewContainer/cover-image.md +++ b/docs/components/viewContainer/cover-image.md @@ -5,7 +5,7 @@ sidebar_label: CoverImage 覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/cover-image.html) diff --git a/docs/components/viewContainer/match-media.md b/docs/components/viewContainer/match-media.md index 197d0aae2770..c0d01532ee6d 100644 --- a/docs/components/viewContainer/match-media.md +++ b/docs/components/viewContainer/match-media.md @@ -6,7 +6,7 @@ sidebar_label: MatchMedia media query 匹配检测节点。可以指定一组 media query 规则,满足时,这个节点才会被展示。 通过这个节点可以实现“页面宽高在某个范围时才展示某个区域”这样的效果。 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/match-media.html) @@ -75,12 +75,12 @@ class App extends Components { ### API 支持度 -| API | 微信小程序 | 支付宝小程序 | H5 | React Native | Harmony | -| :---: | :---: | :---: | :---: | :---: | :---: | -| MatchMediaProps.minWidth | ✔️ | ✔️ | | | | -| MatchMediaProps.maxWidth | ✔️ | ✔️ | | | | -| MatchMediaProps.width | ✔️ | ✔️ | | | | -| MatchMediaProps.minHeight | ✔️ | ✔️ | | | | -| MatchMediaProps.maxHeight | ✔️ | ✔️ | | | | -| MatchMediaProps.height | ✔️ | ✔️ | | | | -| MatchMediaProps.orientation | ✔️ | ✔️ | | | | +| API | 微信小程序 | 支付宝小程序 | 京东小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | :---: | :---: | +| MatchMediaProps.minWidth | ✔️ | ✔️ | ✔️ | | | | +| MatchMediaProps.maxWidth | ✔️ | ✔️ | ✔️ | | | | +| MatchMediaProps.width | ✔️ | ✔️ | ✔️ | | | | +| MatchMediaProps.minHeight | ✔️ | ✔️ | ✔️ | | | | +| MatchMediaProps.maxHeight | ✔️ | ✔️ | ✔️ | | | | +| MatchMediaProps.height | ✔️ | ✔️ | ✔️ | | | | +| MatchMediaProps.orientation | ✔️ | ✔️ | ✔️ | | | | diff --git a/docs/components/viewContainer/page-container.md b/docs/components/viewContainer/page-container.md index cedfa098d919..bda4efb990a5 100644 --- a/docs/components/viewContainer/page-container.md +++ b/docs/components/viewContainer/page-container.md @@ -12,7 +12,7 @@ Bug & Tip 1. tip: 当前页面最多只有 1 个容器,若已存在容器的情况下,无法增加新的容器 2. tip: wx.navigateBack 无法在页面栈顶调用,此时没有上一级页面 -支持情况: +支持情况: > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/component/page-container.html) @@ -47,26 +47,26 @@ ComponentType ### API 支持度 -| API | 微信小程序 | 支付宝小程序 | H5 | React Native | Harmony | -| :---: | :---: | :---: | :---: | :---: | :---: | -| PageContainerProps.show | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.duration | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.zIndex | ✔️ | ✔️ | | | | -| PageContainerProps.overlay | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.position | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.round | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.overlayStyle | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.customStyle | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.closeOnSlideDown | ✔️ | ✔️ | | | | -| PageContainerProps.onBeforeEnter | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.onEnter | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.onAfterEnter | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.onBeforeLeave | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.onLeave | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.onAfterLeave | ✔️ | ✔️ | | ✔️ | | -| PageContainerProps.onClickOverlay | ✔️ | ✔️ | | | | -| PageContainerProps.onEnterCancelled | | ✔️ | | | | -| PageContainerProps.onLeaveCancelled | | ✔️ | | | | +| API | 微信小程序 | 支付宝小程序 | 京东小程序 | H5 | React Native | Harmony | +| :---: | :---: | :---: | :---: | :---: | :---: | :---: | +| PageContainerProps.show | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.duration | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.zIndex | ✔️ | ✔️ | | | | | +| PageContainerProps.overlay | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.position | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.round | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.overlayStyle | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.customStyle | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.closeOnSlideDown | ✔️ | ✔️ | ✔️ | | | | +| PageContainerProps.onBeforeEnter | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.onEnter | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.onAfterEnter | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.onBeforeLeave | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.onLeave | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.onAfterLeave | ✔️ | ✔️ | ✔️ | | ✔️ | | +| PageContainerProps.onClickOverlay | ✔️ | ✔️ | ✔️ | | | | +| PageContainerProps.onEnterCancelled | | ✔️ | | | | | +| PageContainerProps.onLeaveCancelled | | ✔️ | | | | | ### Position diff --git a/docs/components/viewContainer/scroll-view.md b/docs/components/viewContainer/scroll-view.md index cf23ddbec1ba..b3d24c2b92c1 100755 --- a/docs/components/viewContainer/scroll-view.md +++ b/docs/components/viewContainer/scroll-view.md @@ -209,6 +209,7 @@ typeof ScrollViewProps | ariaLabel | `string` | | 否 | 无障碍访问,(属性)元素的额外描述 | | enablePassive | `boolean` | `false` | 否 | 开启 passive 特性,能优化一定的滚动性能 | | type | "list" or "custom" or "nested" | `'list'` | 否 | 渲染模式
list - 列表模式。只会渲染在屏节点,会根据直接子节点是否在屏来按需渲染,若只有一个直接子节点则性能会退化
custom - 自定义模式。只会渲染在屏节点,子节点可以是 sticky-section list-view grid-view 等组件
nested - 嵌套模式。用于处理父子 scroll-view 间的嵌套滚动,子节点可以是 nested-scroll-header nested-scroll-body 组件或自定义 refresher | +| associativeContainer | "draggable-sheet" or "nested-scroll-view" or "pop-gesture" | `''` | 否 | 关联的滚动容器
draggable-sheet - 关联 draggable-sheet 组件 3.2.0
nested-scroll-view - 关联 type=nested 嵌套模式 3.2.0
pop-gesture - 关联 页面手势返回 3.4.0 | | reverse | `boolean` | `false` | 否 | 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。 | | clip | `boolean` | `true` | 否 | 是否对溢出进行裁剪,默认开启 | | cacheExtent | `number` | | 否 | 指定视口外渲染区域的距离,默认情况下视口外节点不渲染。指定 cache-extent 可优化滚动体验和加载速度,但会提高内存占用且影响首屏速度,可按需启用。 | @@ -241,13 +242,17 @@ typeof ScrollViewProps | onTouchMove | `CommonEventFunction` | | 否 | 触摸后移动。 | | onTouchEnd | `CommonEventFunction` | | 否 | 触摸动作结束。 | | onTouchCancel | `CommonEventFunction` | | 否 | 触摸动作被打断,如来电提醒、弹窗。 | +| onScrollStartWorklet | `string` | | 否 | 同 bindscrollstart,但仅支持 worklet 作为回调 | +| onScrollUpdateWorklet | `string` | | 否 | 同 bindscroll ,但仅支持 worklet 作为回调 | +| onScrollEndWorklet | `string` | | 否 | 同 bindscrollend,但仅支持 worklet 作为回调 | +| adjustDecelerationVelocityWorklet | `string` | | 否 | 指定手指抬起时做惯性滚动的初速度。(velocity: number) => number | ### API 支持度 | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| ScrollViewProps.scrollX | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(二选一) | | ✔️ | -| ScrollViewProps.scrollY | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(二选一) | | ✔️ | +| ScrollViewProps.scrollX | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(二选一) | ✔️ | ✔️ | +| ScrollViewProps.scrollY | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️(二选一) | ✔️ | ✔️ | | ScrollViewProps.upperThreshold | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | ScrollViewProps.lowerThreshold | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | ScrollViewProps.scrollTop | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | @@ -265,7 +270,7 @@ typeof ScrollViewProps | ScrollViewProps.enhanced | ✔️ | ✔️ | | | | | | | | | | ScrollViewProps.usingSticky | ✔️ | | | | | | | | | | | ScrollViewProps.bounces | ✔️ | ✔️ | | | | | | | | | -| ScrollViewProps.showScrollbar | ✔️ | | | | | | | | | | +| ScrollViewProps.showScrollbar | ✔️ | | | | | | | | ✔️ | | | ScrollViewProps.pagingEnabled | ✔️ | | | | | | | | | | | ScrollViewProps.fastDeceleration | ✔️ | | | | | | | | | | | ScrollViewProps.scrollAnimationDuration | | | ✔️ | | | | | | | | @@ -274,7 +279,8 @@ typeof ScrollViewProps | ScrollViewProps.disableUpperScroll | | | ✔️ | | | | | | | | | ScrollViewProps.ariaLabel | | | | | ✔️ | | | | | | | ScrollViewProps.enablePassive | ✔️ | | | | | | | | | | -| ScrollViewProps.type | ✔️ | | | | | | | | | | +| ScrollViewProps.type | ✔️ | | | | | | | | ✔️ | | +| ScrollViewProps.associativeContainer | ✔️ | | | | | | | | | | | ScrollViewProps.reverse | ✔️ | | | | | | | | | | | ScrollViewProps.clip | ✔️ | | | | | | | | | | | ScrollViewProps.cacheExtent | ✔️ | | | | | | | | | | @@ -291,7 +297,7 @@ typeof ScrollViewProps | ScrollViewProps.refresherTwoLevelPinned | ✔️ | | | | | | | | | | | ScrollViewProps.onScrollToUpper | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | ScrollViewProps.onScrollToLower | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| ScrollViewProps.onScroll | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| ScrollViewProps.onScroll | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ScrollViewProps.onScrollStart | ✔️ | | | | | | | | | | | ScrollViewProps.onScrollEnd | ✔️ | | | | | | | | | | | ScrollViewProps.onRefresherPulling | ✔️ | | | | | | | | | | @@ -307,6 +313,10 @@ typeof ScrollViewProps | ScrollViewProps.onTouchMove | | | ✔️ | | | | | | | | | ScrollViewProps.onTouchEnd | | | ✔️ | | | | | | | | | ScrollViewProps.onTouchCancel | | | ✔️ | | | | | | | | +| ScrollViewProps.onScrollStartWorklet | ✔️ | | | | | | | | | | +| ScrollViewProps.onScrollUpdateWorklet | ✔️ | | | | | | | | | | +| ScrollViewProps.onScrollEndWorklet | ✔️ | | | | | | | | | | +| ScrollViewProps.adjustDecelerationVelocityWorklet | ✔️ | | | | | | | | | | | 参数 | 类型 | | --- | --- | diff --git a/docs/components/viewContainer/slot.md b/docs/components/viewContainer/slot.md index dcc8de7292e1..9b43404f2a2f 100644 --- a/docs/components/viewContainer/slot.md +++ b/docs/components/viewContainer/slot.md @@ -5,7 +5,7 @@ sidebar_label: Slot slot 插槽 -支持情况: +支持情况: ## 类型 diff --git a/docs/components/viewContainer/swiper-item.md b/docs/components/viewContainer/swiper-item.md index 34e2745654fd..ccc584415f78 100644 --- a/docs/components/viewContainer/swiper-item.md +++ b/docs/components/viewContainer/swiper-item.md @@ -94,6 +94,6 @@ class App extends Component { | API | 微信小程序 | 百度小程序 | 抖音小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| SwiperItemProps.itemId | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwiperItemProps.itemId | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SwiperItemProps.skipHiddenItemLayout | ✔️ | | | | | | | | | SwiperItemProps.deep | | | | | ✔️ | | | | diff --git a/docs/components/viewContainer/swiper.md b/docs/components/viewContainer/swiper.md index 8a06de76b7f4..cb4a4fd6dcd3 100755 --- a/docs/components/viewContainer/swiper.md +++ b/docs/components/viewContainer/swiper.md @@ -115,27 +115,41 @@ class App extends Component { | adjustHeight | "first" or "current" or "highest" or "none" | | 否 | 自动以指定滑块的高度为整个容器的高度。当 vertical 为 true 时,默认不调整。可选值为: | | adjustVerticalHeight | `string` | | 否 | vertical 为 true 时强制使 adjust-height 生效。 | | disableTouchmove | `string` | `false` | 否 | 是否停止响应用户 touchmove 操作 | -| scrollWithAnimation | `boolean` | `true` | 否 | 改变 current 时使用动画过渡 | -| cacheExtent | `number` | `0` | 否 | 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) | +| effectsProps | `Record` | | 否 | swiper11 相关的动效参数,具体见文档 https://swiperjs.com/swiper-api#parameters | | onChange | `CommonEventFunction` | | 否 | current 改变时会触发 change 事件 | | onTransition | `CommonEventFunction` | | 否 | swiper-item 的位置发生改变时会触发 transition 事件 | | onAnimationFinish | `CommonEventFunction` | | 否 | 动画结束时会触发 animationfinish 事件 | | onAnimationEnd | `CommonEventFunction` | | 否 | 动画结束时会触发 animationEnd 事件 | -| effectsProps | `TEffectsProps` | | 否 | [swiperjs](https://swiperjs.com/swiper-api#param-effect) 动效相关的属性 +| layoutType | "normal" or "stackLeft" or "stackRight" or "tinder" or "transformer" | `normal` | 否 | 渲染模式 | +| transformerType | "scaleAndFade" or "accordion" or "threeD" or "zoomIn" or "zoomOut" or "deepthPage" | `scaleAndFade` | 否 | layout-type 为 transformer 时指定动画类型 | +| indicatorType | "normal" or "worm" or "wormThin" or "wormUnderground" or "wormThinUnderground" or "expand" or "jump" or "jumpWithOffset" or "scroll" or "scrollFixedCenter" or "slide" or "slideUnderground" or "scale" or "swap" or "swapYRotation" or "color" | `normal` | 否 | 指示点动画类型 | +| indicatorMargin | `number` | `10` | 否 | 指示点四周边距 | +| indicatorSpacing | `number` | `4` | 否 | 指示点间距 | +| indicatorRadius | `number` | `4` | 否 | 指示点圆角大小 | +| indicatorWidth | `number` | `8` | 否 | 指示点宽度 | +| indicatorHeight | `number` | `8` | 否 | 指示点高度 | +| indicatorAlignment | string or [number, number] | `auto` | 否 | 指示点的相对位置 | +| indicatorOffset | `[number, number]` | `[0, 0]` | 否 | 指示点位置的偏移量 | +| scrollWithAnimation | `boolean` | `true` | 否 | 改变 current 时使用动画过渡 | +| cacheExtent | `number` | `0` | 否 | 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) | +| onScrollStartWorklet | `string` | | 否 | 滑动开始时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} | +| onScrollUpdateWorklet | `string` | | 否 | 滑动位置更新时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} | +| onScrollEndWorklet | `string` | | 否 | 滑动结束时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} | + ### API 支持度 | API | 微信小程序 | 百度小程序 | 支付宝小程序 | 抖音小程序 | QQ 小程序 | 京东小程序 | H5 | React Native | Harmony | Harmony hybrid | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| SwiperProps.indicatorDots | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwiperProps.indicatorColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwiperProps.indicatorActiveColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwiperProps.autoplay | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwiperProps.current | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwiperProps.indicatorDots | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SwiperProps.indicatorColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SwiperProps.indicatorActiveColor | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SwiperProps.autoplay | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SwiperProps.current | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SwiperProps.currentItemId | (deprecated) | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | -| SwiperProps.interval | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwiperProps.duration | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | +| SwiperProps.interval | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | +| SwiperProps.duration | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | SwiperProps.circular | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | -| SwiperProps.vertical | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwiperProps.vertical | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SwiperProps.previousMargin | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | | SwiperProps.nextMargin | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | ✔️ | | SwiperProps.snapToEdge | ✔️ | | ✔️ | | | | | | | | @@ -155,13 +169,26 @@ class App extends Component { | SwiperProps.adjustHeight | | | ✔️ | | | | | | | | | SwiperProps.adjustVerticalHeight | | | ✔️ | | | | | | | | | SwiperProps.disableTouchmove | | ✔️ | | | | | | | | | -| SwiperProps.scrollWithAnimation | ✔️ | | | | | | | | | | -| SwiperProps.cacheExtent | ✔️ | | | | | | | | | | -| SwiperProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | +| SwiperProps.effectsProps | | | | | | | ✔️ | | | | +| SwiperProps.onChange | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | SwiperProps.onTransition | ✔️ | | ✔️ | ✔️ | ✔️ | | | | | | | SwiperProps.onAnimationFinish | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | | SwiperProps.onAnimationEnd | | | ✔️ | | | | | | | | -| SwiperProps.effectsProps | | | | | | | ✔️ | | | | +| SwiperProps.layoutType | ✔️ | | | | | | | | | | +| SwiperProps.transformerType | ✔️ | | | | | | | | | | +| SwiperProps.indicatorType | ✔️ | | | | | | | | | | +| SwiperProps.indicatorMargin | ✔️ | | | | | | | | | | +| SwiperProps.indicatorSpacing | ✔️ | | | | | | | | | | +| SwiperProps.indicatorRadius | ✔️ | | | | | | | | | | +| SwiperProps.indicatorWidth | ✔️ | | | | | | | | | | +| SwiperProps.indicatorHeight | ✔️ | | | | | | | | | | +| SwiperProps.indicatorAlignment | ✔️ | | | | | | | | | | +| SwiperProps.indicatorOffset | ✔️ | | | | | | | | | | +| SwiperProps.scrollWithAnimation | ✔️ | | | | | | | | | | +| SwiperProps.cacheExtent | ✔️ | | | | | | | | | | +| SwiperProps.onScrollStartWorklet | ✔️ | | | | | | | | | | +| SwiperProps.onScrollUpdateWorklet | ✔️ | | | | | | | | | | +| SwiperProps.onScrollEndWorklet | ✔️ | | | | | | | | | | ### TChangeSource @@ -206,15 +233,3 @@ class App extends Component { | --- | --- | --- | | dx | `number` | X 坐标 | | dy | `number` | Y 坐标 | - -### TEffectsProps - -| 参数 | 类型 | 必填 | 说明 | -| --- | --- | :---: | --- | -| effect | `string` | 是 | 可以是 'fade', 'cube', 'coverflow', 'flip', 'creative' 或 'cards' | -| coverflowEffect | `object` | 否 | effect 为 'coverflow' 时的额外参数,详见 [swiperjs coverflow](https://swiperjs.com/swiper-api#param-coverflowEffect) | -| creativeEffect | `object` | 否 | effect 为 'creative' 时的额外参数,详见 [swiperjs creative](https://swiperjs.com/swiper-api#param-creativeEffect) | -| cardsEffect | `object` | 否 | effect 为 'cards' 时的额外参数,详见 [swiperjs cards](https://swiperjs.com/swiper-api#param-cardsEffect) | -| fadeEffect | `object` | 否 | effect 为 'fade' 时的额外参数,详见 [swiperjs fade](https://swiperjs.com/swiper-api#param-fadeEffect) | -| flipEffect | `object` | 否 | effect 为 'flip' 时的额外参数,详见 [swiperjs flip](https://swiperjs.com/swiper-api#param-flipEffect) | -| cubeEffect | `object` | 否 | effect 为 'cube' 时的额外参数,详见 [swiperjs cube](https://swiperjs.com/swiper-api#param-cubeEffect) | diff --git a/sidebars.js b/sidebars.js index 6b9b648f88eb..5924f66b3103 100644 --- a/sidebars.js +++ b/sidebars.js @@ -234,6 +234,18 @@ module.exports = { 'components/forms/textarea' ], 'Skyline': [ + { + '手势系统': [ + 'components/gesture/double-tap-gesture-handler', + 'components/gesture/force-press-gesture-handler', + 'components/gesture/horizontal-drag-gesture-handler', + 'components/gesture/long-press-gesture-handler', + 'components/gesture/pan-gesture-handler', + 'components/gesture/scale-gesture-handler', + 'components/gesture/tap-gesture-handler', + 'components/gesture/vertical-drag-gesture-handler', + ], + }, 'components/skyline/draggable-sheet', 'components/skyline/grid-builder', 'components/skyline/grid-view', @@ -467,6 +479,7 @@ module.exports = { 'apis/route/navigateTo', 'apis/route/navigateBack', 'apis/route/EventChannel', + 'apis/route/router', ], '跳转': [ 'apis/navigate/openBusinessView', @@ -597,6 +610,13 @@ module.exports = { 'apis/ui/window/checkIsPictureInPictureActive', ] }, + { + 'label': 'worklet动画', + 'type': 'category', + 'items': [ + 'apis/skyline/worklet', + ] + }, ], '网络': [ { @@ -1428,6 +1448,7 @@ module.exports = { 'apis/ad/RewardedVideoAd', ], 'Skyline': [ + 'apis/skyline/DraggableSheetContext', 'apis/skyline/Snapshot', ], '云开发': [ From e0304ad2763ca03d45d5fcae23f097dd1df2380e Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Thu, 21 Nov 2024 14:38:59 +0800 Subject: [PATCH 3/7] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0skyline=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/skyline.mdx | 134 +++++++++++++++++++++++++++++++++++++++++++++++ sidebars.js | 10 +++- 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 docs/skyline.mdx diff --git a/docs/skyline.mdx b/docs/skyline.mdx new file mode 100644 index 000000000000..9120dfdcba62 --- /dev/null +++ b/docs/skyline.mdx @@ -0,0 +1,134 @@ +--- +title: Skyline +--- + +import { ReactIcon, VueIcon } from '@site/static/icons' +import TabItem from '@theme/TabItem' +import Tabs from '@theme/Tabs' + +Skyline 的具体内容详见:[Skyline 介绍](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) + +:::info +仅支持在微信小程序使用,worklet 部分从 `4.0.8` 开始支持 +:::info + +## 开启 Skyline + +配置方法和微信小程序相同,开发前请仔细阅读 [《微信小程序 Skyline - 起步》](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/)。 + + +**示例:** + +```js title="app.config.js" +export default defineAppConfig({ + pages: [ + 'pages/index/index', + ] + lazyCodeLoading: "requiredComponents", + rendererOptions: { + skyline: { + defaultDisplayBlock: true, + defaultContentBox: true + } + } +}) +``` + +```js title="page/index/index.config.js" +export default definePageConfig({ + navigationBarTitleText: '首页', + renderer: 'skyline', + componentFramework: 'glass-easel', + navigationStyle: 'custom', +}) +``` + +### 使用 worklet + +在 Taro 中使用 worklet 需要首先开启半编译,开启方法见:[半编译模式使用方法](./complier-mode#使用方法)。 + +使用 worklet 动画能力时确保以下两项:详见 [worklet 动画](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/worklet.html) + +* 确保开发者工具右上角 > 详情 > 本地设置里的 将 JS 编译成 ES5 选项被勾选上 (代码包体积会少量增加) +* worklet 动画相关接口仅在 Skyline 渲染模式下才能使用 + + +**示例:** + +```js title="config/index.js" +{ + mini: { + experimental: { + compileMode: true + } + } +} +``` + +```js title="pages/index/behavior.js" +const behavior = Behavior({ + methods: { + onScrollUpdate(){ + "worklet"; + console.log('onScrollUpdateWorklet') + }, + onGesture(evt) { + 'worklet'; + if (evt.state === 2) { + this._offset.value += evt.deltaX; + } + } + } +}) + +export default behavior +``` + +```jsx title="pages/index/index.jsx" +import { View, ScrollView, PanGestureHandler } from "@tarojs/components"; +import Taro, { useLoad } from "@tarojs/taro"; +import behavior from "./behavior"; + +Index.behaviors = [behavior]; + +export default function Index() { + useLoad(() => { + const { page } = Taro.getCurrentInstance(); + if (page) { + const offset = Taro.worklet.shared(0); + page._offset = offset; + Taro.nextTick(() => { + page.applyAnimatedStyle(".circle", () => { + "worklet"; + return { + transform: `translateX(${offset.value}px)`, + }; + }); + }); + } + }); + + return ( + + {/* 手势 */} + + 拖动我 + + + {/* 非手势组件的 worklet 回调 */} + + {Array(100) + .fill(1) + .map((item, index) => ( + {item} + ))} + + + ); +} +``` diff --git a/sidebars.js b/sidebars.js index 5924f66b3103..c36b8da02569 100644 --- a/sidebars.js +++ b/sidebars.js @@ -63,7 +63,15 @@ module.exports = { { label: '小程序', type: 'category', - items: ['come-from-miniapp', 'wxcloudbase', 'miniprogram-plugin', 'independent-subpackage', 'custom-tabbar', 'mini-troubleshooting'] + items: [ + 'come-from-miniapp', + 'wxcloudbase', + 'miniprogram-plugin', + 'independent-subpackage', + 'custom-tabbar', + 'skyline', + 'mini-troubleshooting' + ] }, 'h5', { From 0ef274a9a5174e43c75315db1214d6aa243d0978 Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Mon, 2 Dec 2024 17:55:04 +0800 Subject: [PATCH 4/7] =?UTF-8?q?docs:=20compile.include=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/config-detail.md | 50 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/docs/config-detail.md b/docs/config-detail.md index 8575487f7505..9596deafc982 100644 --- a/docs/config-detail.md +++ b/docs/config-detail.md @@ -505,7 +505,6 @@ module.exports = { :::info Taro v3.5 开始支持。 - Taro v4.0.0 开始支持 `vite` 值。 ::: @@ -531,7 +530,7 @@ Taro v4.0.0 开始支持 `vite` 值。 webpack 编译过程中的错误类型主要如下两类:1、致命的 wepback 错误(配置出错等)2、编译错误(缺失的 module,语法错误等) -0:表示发生“1、致命的webpack错误(配置出错等)”情况时,返回非 0 的退出码结束进程。 +0:表示发生“1、致命的 webpack 错误(配置出错等)”情况时,返回非 0 的退出码结束进程。 1:表示发生“1、致命的 wepback 错误(配置出错等)2、编译错误(缺失的 module,语法错误等)”情况时,返回非 0 的退出码结束进程。 ### compiler.prebundle @@ -754,9 +753,27 @@ module.exports = { `array` -配置额外**需要经过 Taro 编译的文件**,使用方式与 [mini.compile.exclude](./config-detail#minicompileexclude) 一致,同 [Rule.include](https://webpack.js.org/configuration/module/#ruleinclude)。 +配置额外**需要经过 Taro 编译的文件**,使用方式与 [mini.compile.exclude](./config-detail#minicompileexclude) 一致,同 [Rule.include](https://webpack.js.org/configuration/module/#ruleinclude)。例如 Taro 默认不编译 `node_modules` 中的文件,可以通过这个配置让 Taro 编译 `node_modules` 中的文件。 + +默认值包括 Taro 项目源码目录 src 以及 Taro 相关的 node_modules。如需将 Taro 项目作为 monorepo 项目的子包,则要自行配置 include 以编译其他子包的文件,示例: -例如 Taro 默认不编译 `node_modules` 中的文件,可以通过这个配置让 Taro 编译 `node_modules` 中的文件。 +```js title='config/index.js' +export default { + // ... + mini: { + // ... + compile: { + include: [path.resolve(__dirname, '../../package')], + }, + }, + h5: { + // ... + compile: { + include: [path.resolve(__dirname, '../../package')], + }, + }, +} +``` ### mini.webpackChain @@ -1279,11 +1296,10 @@ module.exports = { `object` -可用于修改、拓展 Webpack 的 **output** 选项,配置项参考[webpack官方文档](https://webpack.js.org/configuration/output/)。 +可用于修改、拓展 Webpack 的 **output** 选项,配置项参考[webpack 官方文档](https://webpack.js.org/configuration/output/)。 vite 编译环境下用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/) - ```js module.exports = { // ... @@ -1743,9 +1759,27 @@ Web 编译过程的相关配置。 `array` -配置额外**需要经过 Taro 编译的文件**,使用方式与 [mini.compile.exclude](./config-detail#minicompileexclude) 一致,同 [Rule.include](https://webpack.js.org/configuration/module/#ruleinclude)。 +配置额外**需要经过 Taro 编译的文件**,使用方式与 [mini.compile.exclude](./config-detail#minicompileexclude) 一致,同 [Rule.include](https://webpack.js.org/configuration/module/#ruleinclude)。例如 Taro 默认不编译 `node_modules` 中的文件,可以通过这个配置让 Taro 编译 `node_modules` 中的文件。 + +默认值包括 Taro 项目源码目录 src 以及 Taro 相关的 node_modules。如需将 Taro 项目作为 monorepo 项目的子包,则要自行配置 include 以编译其他子包的文件,示例: -例如 Taro 默认不编译 `node_modules` 中的文件,可以通过这个配置让 Taro 编译 `node_modules` 中的文件。 +```js title='config/index.js' +export default { + // ... + mini: { + // ... + compile: { + include: [path.resolve(__dirname, '../../package')], + }, + }, + h5: { + // ... + compile: { + include: [path.resolve(__dirname, '../../package')], + }, + }, +} +``` ### h5.htmlPluginOption From e47abeda8f3a53cb32784c30071179459b2eeddd Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Mon, 2 Dec 2024 17:56:15 +0800 Subject: [PATCH 5/7] =?UTF-8?q?docs:=20=E5=AE=8C=E5=96=84=E8=BD=ACes5?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/h5.md | 99 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 13 deletions(-) diff --git a/docs/h5.md b/docs/h5.md index 8db1cc3cf0e8..14aa08c320dc 100644 --- a/docs/h5.md +++ b/docs/h5.md @@ -8,7 +8,17 @@ title: H5 ### ES5 -默认配置下,`@babel/preset-env` 的 `target` 配置为: +#### JS 版本 + +为了更高的编译效率和更小的产物体积,V4 开始默认的 browserslist 配置调整为: + +```json +{ + "browserslist": ["defaults and fully supports es6-module", "maintained node versions"] +} +``` + +> 如不存在 browserslist 相关配置,则会使用 `@babel/preset-env` 的 `target` 默认配置,如下: ```js targets = { @@ -17,25 +27,88 @@ targets = { } ``` -如果需要兼容更低版本的系统,请修改在项目根目录的 `babel.config.js` 中修改 `babel-preset-taro` 的配置。[文档](/docs/babel-config) +#### 将代码编译为 ES5 + +V4.0.8 开始使用脚手架创建项目时新增了`是否编译为ES5`的确认项,如选择`是`,生成的项目会在生产模式打包时将全量代码编译为 ES5。需要注意的是:编译为 ES5 会影响编译效率和产物体积。 -#### babel-loader +也可以通过如下配置将代码编译为 ES5: -为了提升编译速度,Taro 给 `babel-loader` 设置了 `exclude` 属性。对于 `node_modules` 里(除了命名含有 `taro`)的依赖,都不经过 babel 编译。`babel-loader` 配置请看 [Github](https://github.com/NervJS/taro/blob/4aa08d541b1c5221bf420fc0f4a305960e22aa0a/packages/taro-webpack-runner/src/util/chain.ts#L502-L510)。 +1. 修改 browserslist -因此需要注意以下问题: +```json title='package.json' +{ + "browserslist": { + "development": ["defaults and fully supports es6-module", "maintained node versions"], + "production": ["last 3 versions", "Android >= 4.1", "ios >= 8"] + } +} +``` + +2. 设置 BROWSERSLIST_ENV 环境变量,以便在不同环境使用不同的 browserslist 配置 + +```js title='config/index.js' +process.env.BROWSERSLIST_ENV = process.env.NODE_ENV +``` -- `@tarojs/components` 默认不经 Babel 编译,但 `3.2.10` 之前没有编译出 ES5 包,请更新到 `3.2.10` 及以上版本。 -- 默认不编译 `node_modules` 里的依赖,如有兼容性需求,请手动使用 [WebpackChain](config-detail#h5webpackchain) 修改 `babel-loader` 的 `exclude` 属性。 +3. 修改 `babel-preset-taro` 的配置。[文档](babel-config#usebuiltins) -#### Android 4.4 +```js title='babel.config.js' +useBuiltIns: process.env.TARO_ENV === 'h5' ? 'usage' : false +``` + +4. 修改编译范围 + +```js title='config/prod.js' +// 编译器为 webpack 时 +h5: { + compile: { + include: [ + // 确保产物为 ES5,如可以确认包含 ES6 代码的 node_modules,则可修改正则采用白名单方式缩小编译范围,以提升编译速度 + filename => /node_modules\/(?!(@babel|core-js|style-loader|css-loader|react|react-dom))/.test(filename) + ] + } +} + +// 编译器为 vite 时 +h5: { + legacy: true, +} +``` + +> 小程序可根据自己需求决定是否需要配置和 H5 一样的 include。 + +> V4.0.8 之前的版本由于默认 exclude 了 `@tarojs/components`,而 exclude 优先级高于 include,所以需要按下述方法配置: + +```js title='config/prod.js' +h5: { + webpackChain (chain) { + chain.merge({ + module: { + rule: { + myloader: { + test: /\.js$/, + use: [ + { + loader: 'babel-loader', + options: {}, + }, + ], + }, + }, + }, + }); + } +} +``` -兼容安卓 4.4 请确认完成了以下操作: +#### 其他注意事项 -- Taro 使用 `v3.2.15+` 版本。 -- 使用兼容性组件库(暂时只支持 React)。 -- 合理配置 `babel-preset-taro`,安装 `corejs3`。 -- 如还是遇到 `Promise undefined` 的问题,可在 `index.html` 中手动引入一个 Promise 的 polyfill。 +- Taro 内置的 `babel-loader` 配置请查看 [H5WebpackModule](https://github.com/NervJS/taro/blob/8317e63d0345e18dedcccc34c3ae672ef829f304/packages/taro-webpack5-runner/src/webpack/H5WebpackModule.ts#L258)。 +- V4.0.8 开始 `@tarojs/components` 也会经过 Babel 编译。 +- 除了通过 `h5.compile` 来新增 include 和 exclude,您也可使用 [WebpackChain](config-detail#h5webpackchain) 来修改 Taro 内置的 `babel-loader` 配置。 +- 如果还会遇到兼容性问题(如 Android 4.4),可考虑以下几点: + - 使用兼容性组件库(暂时只支持 React),见:[兼容性组件库](h5#react-兼容性组件库)。 + - 如遇到 `Promise undefined` 等问题,可在 `index.html` 中手动引入一个 Promise 的 polyfill。 ### 组件库 From 7a91414c2cee94e7e9ab4ee08df95fabf1ab6e23 Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Mon, 2 Dec 2024 18:05:56 +0800 Subject: [PATCH 6/7] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E6=8C=87=E5=8D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/CONTRIBUTING-GUIDE.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/CONTRIBUTING-GUIDE.md b/docs/CONTRIBUTING-GUIDE.md index fd8167dc4260..d23d35359257 100644 --- a/docs/CONTRIBUTING-GUIDE.md +++ b/docs/CONTRIBUTING-GUIDE.md @@ -7,7 +7,7 @@ title: 贡献指南 ### 1. 环境准备 :::note -需要安装 [Node.js 16](https://nodejs.org/en/)(建议安装 `16.20.0` 及以上版本)及 [pnpm 7](https://pnpm.io/zh/installation) +需要安装 [Node.js](https://nodejs.org/en/)(`18` 及以上版本)及 [pnpm 9](https://pnpm.io/zh/installation) 各版本 pnpm 与各版本 Node.js 之间的支持情况见 [pnpm 兼容性](https://pnpm.io/zh/installation#%E5%85%BC%E5%AE%B9%E6%80%A7) ::: @@ -36,7 +36,16 @@ Taro 由一系列子 npm 包组成,整体项目组织基于 **pnpm workspace** $ pnpm --filter [package-name] run dev ``` -开发过程中,一般会使用 **link** 的方式把需要调试的包软链到一个测试项目中,然后便可进行断点调试。开发者可以根据测试项目的包管理器以及自己的喜好选择使用 [npm link](https://docs.npmjs.com/cli/v7/commands/npm-link) 或 [yarn link](https://yarnpkg.com/cli/link)(推荐)或 [pnpm link](https://pnpm.io/zh/cli/link) 。 +开发过程中,一般会使用 **link** 的方式把需要调试的包软链到一个测试项目中,然后便可进行断点调试。开发者可以根据测试项目的包管理器以及自己的喜好选择使用 `内置命令` 或 [npm link](https://docs.npmjs.com/cli/v7/commands/npm-link) 或 [yarn link](https://yarnpkg.com/cli/link)(推荐)或 [pnpm link](https://pnpm.io/zh/cli/link) 。 + +**使用 `内置命令` 的具体示例如下:** + +```bash +$ pnpm run debug --projectPath /Users/taro/testapp --packages @tarojs/shared,@tarojs/runtime +``` + +1. 此命令会自动 `link` 并启动编译 `packages` 参数中的 npm 包 +2. 增加`--unlink`参数可批量 unlink **使用 `yarn link` 的具体示例如下:** From f975e33e08262d595983ec121715cd658f652ca5 Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Mon, 2 Dec 2024 18:06:25 +0800 Subject: [PATCH 7/7] =?UTF-8?q?chore:=20=E4=B8=BB=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=88=87=E5=88=B04.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 353c228d57b4..3ddbbd206fe8 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -74,7 +74,7 @@ const siteConfig = { // sidebars file relative to website dir. sidebarPath: require.resolve('./sidebars.js'), editUrl: 'https://github.com/nervjs/taro-docs/edit/master/', - lastVersion: '3.x', + lastVersion: 'current', versions: { current: { label: '4.x',