Skip to content

Commit

Permalink
fix(components): 增加 slot typings
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam authored and Chen-jj committed Aug 28, 2020
1 parent f6d04fe commit 1375193
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions packages/taro-components/types/Slot.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ComponentType } from 'react'

interface SlotProps {
/** 指定插入的 slot 位置
* @default none
* @supported weapp, swan, alipay, tt, jd, qq
*/
name?: string,
/** scoped slot 传入数据源
* @default none
* @supported swan
*/
varName?: string
}

/** slot 插槽
* @supported weapp, swan, alipay, tt, jd, qq
* @example
* ```tsx
* import { Slot, View, Text } from '@tarojs/components'
*
* export default class SlotView extends Component {
* render () {
* return (
* <View>
* <custom-component>
* <Slot name='title'>
* <Text>Hello, world!</Text>
* </Slot>
* </custom-component>
* </View>
* )
* }
* }
* ```
*/
declare const Slot: ComponentType<SlotProps>

export { Slot, SlotProps }
1 change: 1 addition & 0 deletions packages/taro-components/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ export { WebView } from './WebView'
export { OfficialAccount } from './OfficialAccount'
export { NavigationBar } from './NavigationBar'
export { PageMeta } from './PageMeta'
export { Slot } from './Slot'
export * from './common'
export * from './event'

0 comments on commit 1375193

Please sign in to comment.