下一个基础库版本中,取消支持position: sticky?
- 当前 Bug 的表现(可附上截图)
- 预期表现
- 提供一个最简复现 Demo
<!--moui.wxml--><template name='Navbar'> <view class='moui-navbar' style='--activeIndex:{{activeIndex}};position:sticky;top:0;padding-top:{{statusBarHeight||"20"}}px;border:0'> <block wx:for='{{tabs}}' wx:key='*this'> <view id='{{index}}' style='width:144rpx;{{textStyle||""}}' bindtap='{{bindtap}}' class='moui-navbar__item {{activeIndex==index?"active":""}}'> {{item}} </view> </block> <view wx:if="{{reload}}" bindtap='confirmReload' hover-class='card-hover' style='width:22px;height:22px;padding:10px;border-radius:50%'> <view class='icon-reload' style='width:22px;height:22px' /> </view> <view class='moui-navbar__slider' style='width:32px;height:2px;left:calc((var(--activeIndex) + 0.5) * 144rpx - 16px)'/> </view></template><!--page--><import src='./path/to/moui.wxml' /><template is='Navbar' data='{{...Navbar}}' /> |
// page.jsPage({ data: { Navbar: { activeIndex: 0, ...appData.systemInfo, tabs: ['问卷', '收藏'], bindtap: 'bindChangeIndex', textStyle: 'transition:none;-webkit-transition:none', }, }, bindChangeIndex: function ({ currentTarget: { id }, detail: { current, source } } = {}) { if (id.toString() || source === 'touch') { let activeIndex = id.toString() || current; if (parseInt(activeIndex) !== this.data.Navbar.activeIndex) { this.setData({ ['Navbar.activeIndex']: parseInt(activeIndex) }); } } },}); |
/** app.wxss **/@import 'style/moui.wxss';/** https://github.com/mofong/moUI **/ |
