| | |
| | | </header> |
| | | <section class="quotes-tab-container"> |
| | | <van-tabs v-model:active="tabActive" shrink @click-tab="onClickTab"> |
| | | <van-tab v-for="(item) in listTab" :key="item.tabIndex" :name="item.tabIndex" :title="item.title"> |
| | | <component v-if="item.tabIndex == tabActive" @changeLetMego="handleChangeLetMego" :index="item.tabIndex" :tabActive="tabActive" |
| | | <van-tab v-for="(item, index) in listTab" :key="item.tabIndex" :name="item.tabIndex" :title="item.title"> |
| | | <component @changeLetMego="handleChangeLetMego" :index="item.tabIndex" :tabActive="tabActive" |
| | | :is="components.get(item.type)" :key="item.tabIndex" ref="tabRefs" /> |
| | | </van-tab> |
| | | </van-tabs> |
| | |
| | | |
| | | const thStore = themeStore() |
| | | |
| | | |
| | | const { t } = useI18n() |
| | | |
| | | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const tabActive = ref(8) |
| | | const tabActive = ref(0) |
| | | const TITLE = import.meta.env.VITE_APP__TITLE |
| | | const showSave = ref(false) |
| | | const searchSrc = new URL(`../../assets/theme/${thStore.theme}/image/search.png`, import.meta.url) |
| | |
| | | ) |
| | | const listTab = ref([ |
| | | { |
| | | title: t('UsStocks'), |
| | | type: 'UsStock', |
| | | urlMatch: 'stock', |
| | | symbolType: 'US-stocks', |
| | | tabIndex: 3 |
| | | title: 'ETF', |
| | | type: 'Etf', |
| | | urlMatch: 'etf', |
| | | symbolType: 'indices', |
| | | tabIndex: 8 |
| | | }, |
| | | { |
| | | title: t('加密货币'), |
| | |
| | | symbolType: 'cryptos', |
| | | tabIndex: 1 |
| | | }, |
| | | { |
| | | title: 'ETF', |
| | | type: 'Etf', |
| | | urlMatch: 'etf', |
| | | symbolType: 'indices', |
| | | tabIndex: 8 |
| | | }, |
| | | // { |
| | | // title: t('印度股'), |
| | | // type: 'INDIAStock', |
| | |
| | | // symbolType: 'INDIA-stocks', |
| | | // tabIndex: 0 |
| | | // }, |
| | | // { |
| | | // title: t('港股'), |
| | | // type: 'HkStock', |
| | | // urlMatch: 'HK-stocks', |
| | | // symbolType: 'HK-stocks', |
| | | // tabIndex: 4 |
| | | // }, |
| | | { |
| | | title: t('UsStocks'), |
| | | type: 'UsStock', |
| | | urlMatch: 'stock', |
| | | symbolType: 'US-stocks', |
| | | tabIndex: 3 |
| | | }, |
| | | { |
| | | title: t('港股'), |
| | | type: 'HkStock', |
| | | urlMatch: 'HK-stocks', |
| | | symbolType: 'HK-stocks', |
| | | tabIndex: 4 |
| | | }, |
| | | // { |
| | | // title: t('台股'), |
| | | // type: 'TWStock', |
| | |
| | | return relUrl; |
| | | } |
| | | |
| | | |
| | | const closeSaveBox = () => { |
| | | setStorage(`${TITLE}addtoClosed`, 1) |
| | | showSave.value = false |
| | |
| | | }, TIME_OUT) |
| | | |
| | | const onClickTab = ({ name, title }) => { |
| | | // console.log('name', name) |
| | | console.log('name', name) |
| | | if (tabActive.value !== name) { |
| | | letMeGo.value = () => { } |
| | | } |
| | | // 如果切换到 name 是 3,停止 timer 轮询 |
| | | if (name === 3) { |
| | | if (timer) { |
| | | clearInterval(timer) |
| | | timer = null |
| | | } |
| | | } else { |
| | | // 如果不是 3 并且 timer 没有轮询,则继续轮询 |
| | | if (!timer) { |
| | | timer = setInterval(() => { |
| | | letMeGo.value() |
| | | }, TIME_OUT) |
| | | } |
| | | } |
| | | tabActive.value = name |
| | | router.push('/quotes/index?tabActive=' + tabActive.value) |