mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
💄 添加 switch,调整样式
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- todo 支持 share -->
|
<!-- todo 支持 share -->
|
||||||
<TOverlay v-model="visible" hide :to-click="onCancel" blur-val="20px">
|
<TOverlay v-model="visible" hide :to-click="onCancel" blur-val="20px">
|
||||||
<div class="ton-box" v-if="props.data">
|
<div v-if="props.data" class="ton-container">
|
||||||
|
<slot name="left"></slot>
|
||||||
|
<div class="ton-box">
|
||||||
<img alt="bg" class="ton-bg" v-if="props.data" :src="props.data.profile" />
|
<img alt="bg" class="ton-bg" v-if="props.data" :src="props.data.profile" />
|
||||||
<div class="ton-content">
|
<div class="ton-content">
|
||||||
<span>{{ props.data.name }}</span>
|
<span>{{ props.data.name }}</span>
|
||||||
@@ -9,6 +11,8 @@
|
|||||||
<span>获取途径:{{ props.data.source }}</span>
|
<span>获取途径:{{ props.data.source }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<slot name="right"></slot>
|
||||||
|
</div>
|
||||||
</TOverlay>
|
</TOverlay>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -39,6 +43,13 @@ function onCancel() {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
|
.ton-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
column-gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.ton-box {
|
.ton-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -75,7 +86,12 @@ function onCancel() {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ton-content :not(:nth-child(1)) {
|
.ton-content :nth-child(2) {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ton-content :nth-child(3) {
|
||||||
|
border-top: 1px dotted var(--tgc-white-1);
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -15,7 +15,18 @@
|
|||||||
</v-list>
|
</v-list>
|
||||||
</template>
|
</template>
|
||||||
</v-virtual-scroll>
|
</v-virtual-scroll>
|
||||||
<ToNamecard v-model="visible" :data="curNameCard" />
|
<ToNamecard v-model="visible" :data="curNameCard">
|
||||||
|
<template #left>
|
||||||
|
<div class="card-arrow left" @click="switchCard(false)">
|
||||||
|
<img src="../../assets/icons/arrow-right.svg" alt="right" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #right>
|
||||||
|
<div class="card-arrow" @click="switchCard(true)">
|
||||||
|
<img src="../../assets/icons/arrow-right.svg" alt="right" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ToNamecard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -35,6 +46,24 @@ function toNameCard(item: TGApp.App.NameCard.Item) {
|
|||||||
curNameCard.value = item;
|
curNameCard.value = item;
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function switchCard(isNext: boolean) {
|
||||||
|
const index = AppNameCardsData.findIndex((item) => item.name === curNameCard.value?.name);
|
||||||
|
if (index === -1) return;
|
||||||
|
if (isNext) {
|
||||||
|
if (index === AppNameCardsData.length - 1) {
|
||||||
|
curNameCard.value = AppNameCardsData[0];
|
||||||
|
} else {
|
||||||
|
curNameCard.value = AppNameCardsData[index + 1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (index === 0) {
|
||||||
|
curNameCard.value = AppNameCardsData[AppNameCardsData.length - 1];
|
||||||
|
} else {
|
||||||
|
curNameCard.value = AppNameCardsData[index - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.tw-nc-box {
|
.tw-nc-box {
|
||||||
@@ -54,4 +83,27 @@ function toNameCard(item: TGApp.App.NameCard.Item) {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-family: var(--font-title);
|
font-family: var(--font-title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-arrow {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .card-arrow {
|
||||||
|
filter: invert(11%) sepia(73%) saturate(11%) hue-rotate(139deg) brightness(97%) contrast(81%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-arrow img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-arrow.left img {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user