Skip to content

Commit

Permalink
fix(actionsheet): 修复ActionSheet的更新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
SzHeJason committed Aug 10, 2018
1 parent c4cd55d commit 4ad034a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/components/action-sheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default class AtActionSheet extends Component {
super(...arguments)
const { isOpened } = props

console.log(props, props.onCancle)
this.state = {
isOpened
}
Expand Down
15 changes: 12 additions & 3 deletions src/pages/action/action-sheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ export default class ActionSheetPage extends Taro.Component {
}
}

handleClose = () => {

handleClose = name => {
console.log(name)
this.setState({
[`isOpened${name}`]: false
})
}

handleCancle = () => {
Expand Down Expand Up @@ -97,7 +100,11 @@ export default class ActionSheetPage extends Taro.Component {
</View>
</View>

<AtActionSheet cancleText='取消' isOpened={isOpened1}>
<AtActionSheet
cancleText='取消'
isOpened={isOpened1}
onClose={this.handleClose.bind(this, 1)}
>
<AtActionSheetItem
onClick={this.showToast.bind(this, '点击了按钮一')}
>
Expand All @@ -113,6 +120,7 @@ export default class ActionSheetPage extends Taro.Component {
<AtActionSheet
cancleText='取消'
isOpened={isOpened2}
onClose={this.handleClose.bind(this, 2)}
title='清除位置信息后, 别人将不能查看到你\r\n可以通过转义字符换行'
>
<AtActionSheetItem
Expand All @@ -130,6 +138,7 @@ export default class ActionSheetPage extends Taro.Component {
<AtActionSheet
cancleText='取消'
isOpened={isOpened3}
onClose={this.handleClose.bind(this, 3)}
title='清除位置信息后, 别人将不能查看到你\r\n可以通过转义字符换行'
>
<AtActionSheetItem
Expand Down

0 comments on commit 4ad034a

Please sign in to comment.