var userRoles = userRolesName.Where(x=>userRolesName.Contain(x.Name));
生命周期方法。谁能告诉我是否有解决方法?
答案 0 :(得分:0)
我还没有尝试过,但是应该可以
constructor() {
window.addEventListener('orientationchange', this.onOrientationChange);
this.state = {
orientation: null
}
}
onOrientationChange = () => {
switch(window.orientation) {
case -90 || 90:
this.setState({orientation: 'landscape'})
break;
default:
this.setState({orientation: 'portrait'})
break;
}
}
componentDidUpdate() {
console.log('componentDidUpdate called', this.state.orientation)
}
看看那个answer