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

NavBar的fixed设置为true,直接把下面的内容挡住了 #2887

Closed
ch-boogeyman opened this issue Mar 19, 2020 · 10 comments · Fixed by #2896
Closed

NavBar的fixed设置为true,直接把下面的内容挡住了 #2887

ch-boogeyman opened this issue Mar 19, 2020 · 10 comments · Fixed by #2896
Milestone

Comments

@ch-boogeyman
Copy link

作为导航栏应该能有吸顶效果吧?能否增加?
1

@rex-zsd
Copy link
Collaborator

rex-zsd commented Mar 19, 2020

fixed之后,是需要开发者自己给页面设定padding-top把内容顶下去的。

@rex-zsd
Copy link
Collaborator

rex-zsd commented Mar 19, 2020

这个应该没有问题吧……

@rex-zsd rex-zsd closed this as completed Mar 19, 2020
@ch-boogeyman
Copy link
Author

这个应该没有问题吧……

岂不是要动态获取导航栏的高度,然后才能设定合适的padding。
我看colorui的导航栏是可以直接使用的,不是有个css样式叫做吸顶的吗,vant应该加一个吧……

@rex-zsd
Copy link
Collaborator

rex-zsd commented Mar 19, 2020

colorui的nav对应的是Tab,不是NavBar哈

@rex-zsd
Copy link
Collaborator

rex-zsd commented Mar 19, 2020

vant weapp可以给fixed状态的nav bar填充一个占位块,占住顶部的位置。

@rex-zsd rex-zsd reopened this Mar 19, 2020
@rex-zsd rex-zsd added this to the 1.1.0 milestone Mar 19, 2020
@ch-boogeyman
Copy link
Author

微信图片_20200319213101
还有这好像有个hover-class,我代码层面无法把它去除~~

@agoni1212
Copy link
Contributor

@zszjszlk2 你是怎么把它顶上最上面的,我通过custom-class设置padding-top 无效

@ch-boogeyman
Copy link
Author

@zszjszlk2 你是怎么把它顶上最上面的,我通过custom-class设置padding-top 无效

在他下面加多一个view来顶开,话说导航栏高度是怎么计算的,vant这里封装的不好啊,对面colorui的随拿随用。
但是我已经用了vant的不好改了。

@agoni1212
Copy link
Contributor

可能的问题是在这里

created() {
const { statusBarHeight } = wx.getSystemInfoSync();
this.setData({ statusBarHeight });
},

这是官方说明:

created | Function | 否 | 组件生命周期函数-在组件实例刚刚被创建时执行,注意此时不能调用 setData )

@rex-zsd
Copy link
Collaborator

rex-zsd commented Mar 20, 2020

可能的问题是在这里

created() {
const { statusBarHeight } = wx.getSystemInfoSync();
this.setData({ statusBarHeight });
},

这是官方说明:

created | Function | 否 | 组件生命周期函数-在组件实例刚刚被创建时执行,注意此时不能调用 setData )

vant weapp内部的created不对应小程序的created

rex-zsd added a commit to rex-zsd/vant-weapp that referenced this issue Mar 21, 2020
@rex-zsd rex-zsd modified the milestones: 1.1.0, 1.1.1 Mar 23, 2020
rex-zsd added a commit that referenced this issue Mar 23, 2020
* feat(NavBar): add new prop fill

fix #2887

* refactor(NavBar): rename fill to placeholder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants