import { View, Text } from '@tarojs/components' import './Segment.scss' import { useState } from 'react' export default function Component(props: { index?: number, titles: Array, changed: Function }) { const [current, setCurrent] = useState(props.index ? props.index : 0) function selItem(index) { setCurrent(index); props.changed(index); } return {e.stopPropagation(); selItem(0) }}> {props.titles[0]} {e.stopPropagation(); selItem(1) }}> {props.titles[1]} }