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
}