You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
4.0 KiB
193 lines
4.0 KiB
<template>
|
|
<view class="page-container">
|
|
<scroll-view scroll-y="true" style="400px">
|
|
<!-- 1. 顶部导航与 Tab 切换 -->
|
|
<view class="header-nav">
|
|
<!-- 返回箭头 -->
|
|
<!-- <view class="back-btn"></view> -->
|
|
|
|
<!-- 滚动的 Tabs -->
|
|
<scroll-view class="tab-scroll" scroll-x="true" :show-scrollbar="false">
|
|
<view class="tab-list">
|
|
<view class="tab-item" v-for="tab in tabs" :key="tab.id" :class="{ active: activeTab === tab.id }" @click="switchTab(tab.id)">
|
|
{{ $t(tab.name) }}
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
|
|
<!-- 2. 主体白底卡片内容区 -->
|
|
<view class="main-card">
|
|
<scroll-view scroll-y="true" class="scroll-area">
|
|
<view v-if="activeTab == 'optional'">自选</view>
|
|
<view v-if="activeTab == 'spot'">
|
|
<ExchangeOperation :isShow="isShow"></ExchangeOperation>
|
|
</view>
|
|
<view v-if="activeTab == 'futures'">
|
|
<Contract :futuressymbol="symbol" :isShow="isShow"></Contract>
|
|
</view>
|
|
<view v-if="activeTab == 'stock'">
|
|
<StockexchangeOperation :stocksymbol="symbol" :isShow="isShow"></StockexchangeOperation>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Contract from "./contract";
|
|
import ExchangeOperation from "./exchange-operation";
|
|
import StockexchangeOperation from "./stockexchange-operation";
|
|
export default {
|
|
components: {
|
|
Contract,
|
|
ExchangeOperation,
|
|
StockexchangeOperation
|
|
},
|
|
props: {
|
|
symbol: {
|
|
default: '',
|
|
type: String
|
|
},
|
|
num: {
|
|
default: 0,
|
|
type: Number
|
|
},
|
|
isShow: {
|
|
default: false,
|
|
type: Boolean,
|
|
required: false,
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
activeTab: 'spot', // 当前选中的 Tab
|
|
|
|
// Tabs 定义
|
|
tabs: [
|
|
// { id: 'optional', name: '自選' },
|
|
{ id: 'spot', name: 'homeNewText.hh17' },
|
|
{ id: 'futures', name: 'homeNewText.hh18' },
|
|
{ id: 'stock', name: 'homeNewText.hh19' }
|
|
]
|
|
};
|
|
},
|
|
watch: {
|
|
isShow(n) {
|
|
if (n&&this.num==1) {
|
|
this.activeTab = 'futures'
|
|
}else if(n&&this.num==2){
|
|
this.activeTab = 'stock'
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
mounted() {
|
|
if (this.num==1) {
|
|
this.activeTab = 'futures'
|
|
} else if(this.num==2){
|
|
this.activeTab = 'stock'
|
|
}
|
|
},
|
|
methods: {
|
|
// 切换 Tab
|
|
switchTab(tabId) {
|
|
this.activeTab = tabId;
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
/* 设置页面背景为浅灰色,衬托出白色卡片 */
|
|
/* page {
|
|
background-color: #f7f8fa;
|
|
height: 100%;
|
|
} */
|
|
</style>
|
|
|
|
<style scoped lang="scss">
|
|
.page-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* ================= 1. 顶部导航区 ================= */
|
|
.header-nav {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 20rpx 0 0 20rpx;
|
|
background-color: var(--panel-3); /* 与页面背景同色 */
|
|
height: 100rpx;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* 纯 CSS 画返回箭头 */
|
|
.back-btn {
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-right: 10rpx;
|
|
}
|
|
.arrow-left {
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
border-left: 4rpx solid #333;
|
|
border-bottom: 4rpx solid #333;
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
/* 滚动 Tabs */
|
|
.tab-scroll {
|
|
flex: 1;
|
|
// white-space: nowrap; /* 保证不换行 */
|
|
}
|
|
.tab-list {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
.tab-item {
|
|
width: 120rpx;
|
|
display: inline-block;
|
|
font-size: 30rpx;
|
|
color: #666;
|
|
padding: 20rpx 30rpx;
|
|
position: relative;
|
|
transition: all 0.2s;
|
|
}
|
|
.tab-item.active {
|
|
color: #00b578; /* 绿色文字 */
|
|
font-weight: bold;
|
|
}
|
|
/* 激活态的绿色下划线 */
|
|
.tab-item.active::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 30rpx;
|
|
right: 30rpx;
|
|
height: 4rpx;
|
|
background-color: #00b578;
|
|
border-radius: 4rpx;
|
|
}
|
|
|
|
|
|
/* ================= 2. 主体白底卡片区 ================= */
|
|
.main-card {
|
|
flex: 1;
|
|
background-color: #ffffff;
|
|
overflow: hidden;
|
|
}
|
|
.scroll-area {
|
|
height: 1120rpx; /* 让 scroll-view 完美填满 main-card 的高度 */
|
|
width: 100%;
|
|
}
|
|
</style>
|