///
extends NewLifecycle
{ componentWillMount?(): void componentDidMount?(): void componentWillReceiveProps?(nextProps: Readonly
, nextContext: any): void shouldComponentUpdate?(nextProps: Readonly
, nextState: Readonly, nextContext: any): boolean
componentWillUpdate?(nextProps: Readonly
, nextState: Readonly, nextContext: any): void
componentWillUnmount?(): void
componentDidShow?(): void
componentDidHide?(): void
componentDidCatchError?(err: string): void
componentDidNotFound?(obj: PageNotFoundObject): void
onPullDownRefresh?(): void
onReachBottom?(): void
onPageScroll?(obj: PageScrollObject): void
onShareAppMessage?(obj: ShareAppMessageObject): ShareAppMessageReturn
onTabItemTap?(obj: TabItemTapObject): void
onResize?(obj: PageResizeObject): void
}
interface ComponentOptions {
addGlobalClass?: boolean
styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
}
interface ComponentClass
extends StaticLifecycle
{ new (...args: any[]): Component
propTypes?: any // TODO: Use prop-types type definition. defaultProps?: Partial
displayName?: string
}
// ref: packages/taro-runtime/src/current.ts
interface RouterInfo extends ComponentLifecycle {
$scope?: any
}
type PropsWithChildren = P & { children?: React.ReactNode }
interface FunctionComponent {
(props: PropsWithChildren , context?: any): React.ReactElement | null
propTypes?: any // TODO: Use prop-types type definition.
defaultProps?: Partial
config?: Config
options?: ComponentOptions
externalClasses?: string[]
}
type FC = FunctionComponent
interface StatelessFunctionComponent {
(): JSX.Element
}
type SFC = StatelessFunctionComponent
interface Show {
componentDidShow?(): void
componentDidHide?(): void
onShow?(): void
onHide?(): void
}
interface AppInstance extends Show {
mount(component: React.ComponentClass | Vue.ComponentOptions (
FunctionComponent: FunctionComponent ,
compare?: (oldProps: P, newProps: P) => boolean
): FunctionComponent
}
}
/** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组(会被 wx://component-export 影响) */
selectAllComponents?<
TD extends Record
/** 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 wx://component-export 影响) */
selectOwnerComponent?<
TD extends Record
/** 获取这个关系所对应的所有关联节点,参见[组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/relations.html) */
getRelationNodes?(relationKey: string): NodesRef[]
/** 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步) */
groupSetData?(callback: () => void): void
/** 返回当前页面的 custom-tab-bar 的组件实例,详见[自定义 tabBar](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html) */
getTabBar?(): ComponentInstance
/** 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 */
getPageId?(): string
/** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
/** 滚动驱动的动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
animate?(selector: string, keyFrames: KeyFrame[], duration: number, scrollTimeline: ScrollTimelineOption): void
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
clearAnimation?(selector: string, callback: () => void): void
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
setUpdatePerformanceListener?(options: {
/** 是否返回变更的 data 字段信息 */
withDataPaths?: boolean
}, listener: () => void): void
}
interface PageInstance extends PageLifeCycle, ComponentInstance {
/** 页面配置 */
config?: PageConfig
data?: Record