vant组件库使用导航栏出现滚动条
遇到问题:
vant组件库使用导航栏时,侧边出现滚动条
问题原因:

原先是中心页面减去下面ul的高,现在因为加入上方的导航栏,导致页面撑大
<div class="box" :style="{height : height}">
1 export default {
2 data () {
3 return {
4 datalist: [],
5 height: '500px'
6 }
7 },
8 mounted () {
9 // 动态结算高度.页面高度-选项卡高度 + 'px'
10 this.height = document.documentElement.clientHeight -
11 document.querySelector('样式名').offsetHeight + 'px'
12 }
解决方法:
<van-nav-bar title="影院" ref="navbar">
// 动态结算高度.页面高度-选项卡高度 + 'px' this.height = document.documentElement.clientHeight -
- this.$refs.navbar.$el.offsetHeight //导航栏的高度
document.querySelector('样式名').offsetHeight + 'px'

浙公网安备 33010602011771号