| | |
| | | </div> |
| | | </div> |
| | | <div class="flex justify-between pt-34"> |
| | | <button |
| | | <!-- <button |
| | | class="tabBtn w-368 h-74 lh-74 border-none rounded" |
| | | :class="selectIndex == 1 ? 'select-active' : 'no-select'" |
| | | @click="changeTab(1)" |
| | | > |
| | | {{ $t("永续合约") }} |
| | | </button> |
| | | </button> --> |
| | | <!-- 资金费率 --> |
| | | <!-- <div class="flex flex-col items-center justify-center ml-20"> |
| | | <div class="text-grey font-24"> |
| | |
| | | // { name:"XTZ/USDT",close:"1.568",change_ratio:"-7.1"}, |
| | | // { name:"ADA/USDT",close:"0.493085",change_ratio:"-4.08"}, |
| | | ], |
| | | interval:null, |
| | | countdown: '', // 用于存储倒计时 |
| | | interval: null, |
| | | countdown: "", // 用于存储倒计时 |
| | | symbolname: "", |
| | | }; |
| | | }, |
| | |
| | | // this.coins = this.coinList.map(item => item.symbol) |
| | | // console.log('this.coins', this.coins) |
| | | this.symbolname = getStorage("symbolname"); |
| | | this.updateCountdown(); // 初始化时立即调用一次 |
| | | this.interval = setInterval(this.updateCountdown, 1000); // 每秒更新一次倒计时 |
| | | this.updateCountdown(); // 初始化时立即调用一次 |
| | | this.interval = setInterval(this.updateCountdown, 1000); // 每秒更新一次倒计时 |
| | | }, |
| | | destroyed() { |
| | | clearInterval(this.interval); // 组件销毁时清除定时器 |
| | | }, |
| | | clearInterval(this.interval); // 组件销毁时清除定时器 |
| | | }, |
| | | methods: { |
| | | updateCountdown() { |
| | | const currentTime = new Date(); // 获取当前时间 |
| | | const targetTime = new Date(currentTime); // 创建目标时间对象 |
| | | targetTime.setHours(24, 0, 0, 0); // 设置目标时间为当前时间后的24小时 |
| | | |
| | | const remainingTime = targetTime - currentTime; // 计算倒计时剩余时间 |
| | | |
| | | if (remainingTime < 0) { |
| | | clearInterval(this.interval); // 倒计时结束,清除定时器 |
| | | this.countdown = "00:00:00"; |
| | | } else { |
| | | const hours = Math.floor(remainingTime / (1000 * 60 * 60)); |
| | | const minutes = Math.floor((remainingTime % (1000 * 60 * 60)) / (1000 * 60)); |
| | | const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000); |
| | | this.countdown = `${hours}:${minutes}:${seconds}`; |
| | | } |
| | | }, |
| | | updateCountdown() { |
| | | const currentTime = new Date(); // 获取当前时间 |
| | | const targetTime = new Date(currentTime); // 创建目标时间对象 |
| | | targetTime.setHours(24, 0, 0, 0); // 设置目标时间为当前时间后的24小时 |
| | | |
| | | const remainingTime = targetTime - currentTime; // 计算倒计时剩余时间 |
| | | |
| | | if (remainingTime < 0) { |
| | | clearInterval(this.interval); // 倒计时结束,清除定时器 |
| | | this.countdown = "00:00:00"; |
| | | } else { |
| | | const hours = Math.floor(remainingTime / (1000 * 60 * 60)); |
| | | const minutes = Math.floor( |
| | | (remainingTime % (1000 * 60 * 60)) / (1000 * 60) |
| | | ); |
| | | const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000); |
| | | this.countdown = `${hours}:${minutes}:${seconds}`; |
| | | } |
| | | }, |
| | | onRoute(item) { |
| | | if (this.$route.params.symbol !== item.symbol) { |
| | | this.$router.push(`/perpetualContract/${item.symbol}`); |