Files
nianxx-h5/src/pages/home/components/AiTabSwitch/index.vue
DEV_DSW df2f158018 feat: add new components and update UI and type declarations
- add AiTabSwitch component with its image assets and styles
- add Welcome component for welcome text, weather display and notice messages
- update ChatMainList to use new components and add background header layout
- replace custom swiper in NoticeMessage with Vant VanSwipe component
- add Vant Swipe type definitions to components.d.ts
2026-05-27 11:06:30 +08:00

58 lines
1.8 KiB
Vue

<template>
<div class="w-full">
<div class="relative w-full h-[50px] flex overflow-hidden">
<div class="tab-item is-left" :class="{ active: modelValue === 0 }" @tap="handleSwitch(0)">
<div class="tab-content">
<img v-if="leftSelected || leftUnselected" :src="modelValue === 0
? leftSelected || leftUnselected
: leftUnselected || leftSelected
" class="tab-image" mode="scaleToFill" />
<div class="tab-label">
<span class="tab-text">探索发现</span>
</div>
</div>
</div>
<div class="tab-item is-right" :class="{ active: modelValue === 1 }" @tap="handleSwitch(1)">
<div class="tab-content">
<img v-if="rightSelected || rightUnselected" :src="modelValue === 1
? rightSelected || rightUnselected
: rightUnselected || rightSelected
" class="tab-image" mode="scaleToFill" />
<div class="tab-label">
<span class="tab-text">AI伴游</span>
<div v-if="showDot" :class="[
'status-dot',
modelValue === 1
? 'status-dot--active'
: 'status-dot--inactive',
]"></div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import leftSelected from "./images/L_02.png";
import leftUnselected from "./images/L_01.png";
import rightSelected from "./images/R_02.png";
import rightUnselected from "./images/R_01.png";
const props = defineProps({
modelValue: { type: Number, default: 0 },
showDot: { type: Boolean, default: true },
});
const emit = defineEmits(["update:modelValue", "change"]);
const handleSwitch = (i) => {
emit("update:modelValue", i);
emit("change", i);
};
</script>
<style lang="scss" scoped>
@import "./styles/index.scss";
</style>