效果展示
![246e01d2474e4a95982ff0f07781ad5b.gif](https://img-blog.csdnimg.cn/img_convert/246e01d2474e4a95982ff0f07781ad5b.gif)
选中样式制作
- 将每个 tab 设置固定宽度。
- 每个tab 添加相对定位,居中,行高
- 添加伪类,伪类设置绝对定位,在底部。
- 设置伪类的宽度为 0%(伪类会继承该元素的宽度)
- 设置选中时候的伪类宽度为50%(视情况而定)
- 给元素添加过渡样式
HTML代码(wxml)
{
{item.name}}
![3f7379123a868b58e3330a5dd87bb88e.png](https://img-blog.csdnimg.cn/img_convert/3f7379123a868b58e3330a5dd87bb88e.png)
CSS(less):
![74fef851bad3c431a0a36bb08c91242d.png](https://img-blog.csdnimg.cn/img_convert/74fef851bad3c431a0a36bb08c91242d.png)
.nav-bar{position: relative;z-index: 10;height: 90upx;white-space: nowrap;backgrou