72 lines
2.6 KiB
Vue
72 lines
2.6 KiB
Vue
<script setup>
|
|
import {useStockQuote} from '@/store/stock-quote/index.js'
|
|
const {getStockQuate,stockQuote}=useStockQuote()
|
|
const date = new Date();
|
|
const options = {
|
|
year: 'numeric',
|
|
month: 'short',
|
|
day: 'numeric',
|
|
hour: 'numeric',
|
|
minute: '2-digit',
|
|
hour12: true,
|
|
timeZone: 'America/New_York',
|
|
timeZoneName: 'short'
|
|
};
|
|
|
|
const formatted = date.toLocaleString('en-US', options);
|
|
getStockQuate()
|
|
</script>
|
|
|
|
<template>
|
|
<main
|
|
ref="main"
|
|
class="flex pt-100px flex-col md:flex-row justify-center items-center gap-32 rounded-3xl "
|
|
>
|
|
<!-- 左侧大号价格 -->
|
|
<section class="flex flex-col items-center justify-center glass-card p-32 rounded-2xl shadow-xl ">
|
|
<div class="text-9xl font-extrabold text-#8A5AFB animate-bg-move select-none drop-shadow-lg">${{ stockQuote.change?.[0].slice(0,4) }}</div>
|
|
<div class="mt-10 text-3xl text-gray-500 font-semibold tracking-widest mb-10px">NASDAQ: <span class="text-black">MINM</span></div>
|
|
<div class="text-gray-500">{{ formatted }}</div>
|
|
</section>
|
|
<!-- 右侧信息卡片 -->
|
|
<section class="grid grid-cols-2 gap-16">
|
|
<div class="info-card">
|
|
<div class="text-lg text-gray-400">Open</div>
|
|
<div class="text-3xl font-bold">{{ stockQuote.Open }}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="text-lg text-gray-400">Change</div>
|
|
<div class="text-3xl font-bold text-red-500 ">{{ stockQuote.change?.join('') }}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="text-lg text-gray-400">Day's Range</div>
|
|
<div class="text-3xl font-bold">{{ stockQuote.DaysRange }}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="text-lg text-gray-400">52-Week Range</div>
|
|
<div class="text-3xl font-bold">{{ stockQuote.Week52Range }}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="text-lg text-gray-400">Volume</div>
|
|
<div class="text-3xl font-bold">{{ stockQuote.Volume }}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="text-lg text-gray-400">Market Cap</div>
|
|
<div class="text-3xl font-bold">{{ stockQuote.MarketCap }}</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
</template>
|
|
|
|
<style scoped>
|
|
/* 玻璃拟态和卡片动画可用 UnoCSS 快捷方式实现,若未配置可加如下样式 */
|
|
.glass-card {
|
|
backdrop-filter: blur(16px);
|
|
background: rgba(255,255,255,0.6);
|
|
border: 1px solid rgba(255,255,255,0.3);
|
|
box-shadow: 0 8px 32px 0 rgba(31,38,135,0.18);
|
|
}
|
|
.info-card {
|
|
@apply glass-card p-6 rounded-xl flex flex-col items-start gap-1 hover:scale-105 transition-transform duration-300;
|
|
}
|
|
</style> |