refactor: split ExpandItem from Mainpage
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
component: true,
|
||||
};
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user