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

Switch 开关选择器在h5中不受变量控制 #1794

Closed
csj8520 opened this issue Jan 3, 2019 · 4 comments
Closed

Switch 开关选择器在h5中不受变量控制 #1794

csj8520 opened this issue Jan 3, 2019 · 4 comments
Assignees

Comments

@csj8520
Copy link

csj8520 commented Jan 3, 2019

在h5中 Switch 开关选择器组件 的checked参数 不受变量控制在小程序里没有问题

@taro-bot
Copy link

taro-bot bot commented Jan 3, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@schinvendy
Copy link

好像他们没注意到这个issue,我补充下demo。

  state = {
    isChecked1: true,
    isChecked2: false
  };

  componentDidMount() {
    setTimeout(() => {
      this.setState({
        isChecked1: false,
        isChecked2: true
      });
    }, 2000);
  }

  render() {
    const { isChecked1, isChecked2 } = this.state;
    return (
      <View className="index">
        <View>H5 Switch测试</View>
        <View>
          <View className="flex">
            <Text>switch 1:</Text>
            <Switch checked={isChecked1} />
          </View>
          <View className="flex">
            <Text>switch 2:</Text>
            <Switch checked={isChecked2} />
          </View>
        </View>
        <View>switch 1 state:{isChecked1 ? 'true' : 'false'}</View>
        <View>switch 2 state:{isChecked2 ? 'true' : 'false'}</View>
      </View>
    );
  }

1 2 4ver

@taro-bot
Copy link

taro-bot bot commented Jan 15, 2019

CC @jinjinjin0731

@wsz7777
Copy link

wsz7777 commented Aug 2, 2019

Switch 修了 Taro-ui 的 AtSwitch 就不管了吗。。。。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants