我使用了 Material UI 版本 3 scrollable-tab ,获取数据后加载选项卡和选项卡容器,但第一个选项卡不会在页面加载时自动加载,需要单击它才能查看信息。
我一直在谷歌周围,尝试设置这个initialSelectedIndex
仍然不起作用,我看到a issue来自Github,但没有进一步的信息。
这是my reproduction code.
非常感谢!
最佳答案
当在 componentDidMount 中发出的请求得到解决时,您可以获取存储库:
componentDidMount() {
const results = fetch("https://api.github.com/users")
.then(res => {
return res.json();
})
.then(data => {
//fetch the repos
this.handleReferences(data[this.state.value].repos_url);
this.setState({ results: data });
});
}
关于javascript - Material-ui V3 在获取数据(或页面加载)后不会加载第一个选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57660021/