uni app 根据选项卡下标跳转对应选项卡页面

A页面根据下标跳转B选项卡的对应位置

<!--A页面 先给一个对应num-->
<view class="night-box">
	<view @tap="goincident(0)">1</view>
	<view @tap="goincident(1)">2</view>
	<view @tap="goincident(2)">3</view>
	<view @tap="goincident(3)">4</view>
</view>
//根据页面跳转事件对应状态
goincident(num) {
	uni.navigateTo({
	url: `../mon-telemetry/mon-telemetry?type=${num}`
	})
}

B页面根据传入的状态,对应显示选项卡页面

<u-navbar :is-back="true" back-icon-color="#fff" title="" :background="background">
	<view class="u-tabs-box">
		<u-tabs-swiper activeColor="#ffffff" inactive-color="#ffffff" ref="tabs" :list="list" :current="current" @change="change"
					 :is-scroll="false" swiperWidth="750" bg-color='#2E95FF'></u-tabs-swiper>
	</view>
</u-navbar>

<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
	<!-- 遥测越线 -->
	<swiper-item class="swiper-item">
		<scroll-view scroll-y style="height: 100%;width: 100%;">
			<view class="page-box">
			<!--内容-->
			</view>
		</scroll-view>
	</swiper-item>	
	<!--..省略重复代码*3-->
</swiper>
		data() {
			return {
				background: {
					backgroundColor: '#2E95FF',
				},
				list: [{ //选项卡名称
						name: '1'
					},
					{
						name: '2'
					},
					{
						name: '3'
					},
					{
						name: '4',
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
			};
		},
		
		onLoad(option) {
			this.current = option.type
			this.swiperCurrent = option.type
			}
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值