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

iphone制作吸顶效果时需要知道navbar的高度,如何获取? #26

Open
silsuer opened this issue Feb 22, 2020 · 5 comments
Open

Comments

@silsuer
Copy link

silsuer commented Feb 22, 2020

如题,iphone制作吸顶效果时需要知道navbar的高度,如何获取?小程序好像是无法拿到自定义组件的高度的

@alukaa
Copy link

alukaa commented Mar 1, 2020

同问.使用自定义导航的时候,taro ui的 message消息提示不能显示,应该是被遮挡住了

@lingxiaoyi
Copy link
Owner

你设置ref 用ref获取试试

@lingxiaoyi
Copy link
Owner

@silsuer
Copy link
Author

silsuer commented Mar 2, 2020

解决了,辛苦。

  componentDidMount() {
    this.refs.nav.boundingClientRect().exec(res => {
      console.log(res)
      this.setState({ height: res[0].height })
    })
   }
 render() {
    return (
      <View ref="nav"></View>
   )
  }

@Anker-z
Copy link

Anker-z commented Sep 7, 2020

//获取navBar高度
let {
navBarHeight,
navBarExtendHeight
} = getApp().globalSystemInfo;
this.setData({
navBarHeight: (navBarHeight + navBarExtendHeight),
})

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

4 participants