refactor: split ExpandItem from Mainpage

This commit is contained in:
Dawn_Ocean
2024-04-08 15:55:01 +08:00
parent 4d6eca0434
commit 097f6832e3
4 changed files with 35 additions and 29 deletions
@@ -0,0 +1,3 @@
export default {
component: true,
};
+31
View File
@@ -0,0 +1,31 @@
import { View } from '@tarojs/components';
import { Component, ReactNode } from 'react';
import { AtAccordion } from 'taro-ui';
export class ExpandItem extends Component {
state = {
open: false,
};
props = {
title: '',
content: <View></View>,
};
handleClick(value: boolean) {
this.setState({ open: value });
}
render(): ReactNode {
return (
<View>
<AtAccordion
open={this.state.open}
onClick={this.handleClick.bind(this)}
title={this.props.title}
>
{this.props.content}
</AtAccordion>
</View>
);
}
}