Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionSheet title属性不支持动态修改。 #269

Closed
giscafer opened this issue Dec 19, 2018 · 4 comments
Closed

ActionSheet title属性不支持动态修改。 #269

giscafer opened this issue Dec 19, 2018 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@giscafer
Copy link

代码

<AtActionSheet
          isOpened={this.state.openActionSheet}
          cancelText='取消'
          title={this.state.actionSheetTitle}
          onCancel={this.handleClose}
          onClose={this.handleClose}>
          <AtActionSheetItem>
            相册选择
          </AtActionSheetItem>
          <AtActionSheetItem>
            拍照上传
          </AtActionSheetItem>
        </AtActionSheet>
 handleClose() {
    this.setState({
      openActionSheet: false
    })
  }
// 展示
  toggleActionSheet(imageType, e) {
    e.stopPropagation();
    const title = this.idcardObj[imageType];
    console.log(title) // 这里有打印出不同的title字符串
    this.setState({
      openActionSheet: true,
      actionSheetTitle: title
    });
  }

重现步骤

设置title属性为动态赋值即可

依赖的版本号

Taro 1.2.0
Taro UI 1.5.2

预期结果

支持动态title变化

实际结果

title值变量实际效果没渲染

截图

test

@giscafer
Copy link
Author

确认过state更新的,是组件不能动态改title

this.setState({
      actionSheetTitle: title
    }, () => {
      this.setState({
        openActionSheet: true,
      })
      console.log(this.state.actionSheetTitle)
    });

@SzHeJason SzHeJason self-assigned this Dec 19, 2018
@koppthe koppthe added the bug Something isn't working label Dec 24, 2018
@SzHeJason
Copy link
Collaborator

SzHeJason commented Dec 26, 2018

没有重现你说的问题 可否提供个简单案例
代码层面上 title 也是动态的

@SzHeJason
Copy link
Collaborator

定位到了 ~~

@SzHeJason
Copy link
Collaborator

9ed24d1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants