import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Image, Text } from '@tarojs/components'
import './index.scss'
type PageOwnProps = {
// 样式
className?: string
// 属性
thumb?: any // 左侧图片
title?: string // 标题
note?: string // 标题下面文字
extThumb?: any // 右侧图片
extraText?: any // 右侧文字
topLine?: boolean // 顶部横线
noBorder?: boolean // 没有边框
disabled?: boolean // 禁用
// 事件
onClick?: any
// 替换
renderThumb?: any // 左侧图片
renderTitle?: any // 替换标题
renderNote?: any // 标题下面文字
renderExtThumb?: any // 右侧图片
renderExtraText?: any // 右侧文字
}
type IProps = PageOwnProps
interface Index {
props: IProps;
}
class Index extends Component {
static options = {
addGlobalClass: true
}
handleClick = (...args) => {
if (this.props.onClick) {
this.props.onClick(...args)
}
}
render() {
const {
title,
thumb,
note,
extThumb,
extraText,
className,
topLine,
noBorder,
disabled,
} = this.props
return (
{/* 图片 */}
{
thumb === undefined
?
this.props.renderThumb
:
}
{/* 标题 */}
{
title === undefined
?
this.props.renderTitle
:
{title}
}
{/* 标题下面文字 */}
{
note === undefined
?
this.props.renderNote
:
{note}
}
{/* 扩展文字 */}
{
extraText === undefined
?
this.props.renderExtraText
:
{extraText}
}
{/* 扩展图片 */}
{
extThumb === undefined
?
this.props.renderExtThumb
:
}
)
}
}
export default Index as ComponentClass