1.tsx代码
import { Component } from "react";
import './index.less'
interface Props {
}
interface User {
ID: string,
text: string
}
interface Con {
ID: string,
text: string
}
interface State {
ButtonIndex: number
ButtonList: User[]
ContentList: Con[]
}
class Tab extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
ButtonIndex: 0,
ButtonList: [
{ ID: "a1", text: "按钮1" },
{ ID: "a2", text: "按钮2" },
{ ID: "a3", text: "按钮3" }
],
ContentList: [
{ ID: "b1", text: "内容1" },
{ ID: "b2", text: "内容2" },
{ ID: "b3", text: "内容3" }
]
}
}
FnTab(index: number): void {
this.setState({
B