feat: 添加后退按钮组件并更新认证路由和视图

This commit is contained in:
2026-01-16 13:20:59 +07:00
parent fb89d3adf7
commit c74a3dd930
7 changed files with 139 additions and 3 deletions

View File

@@ -0,0 +1,28 @@
<script lang='ts' setup>
import { chevronBackOutline } from "ionicons/icons";
const { text = "返回" } = defineProps<{
text?: string;
}>();
const router = useRouter();
function onBack() {
if (window.history.length > 1) {
router.back();
}
else {
router.replace("/");
}
}
</script>
<template>
<button class="z-1 flex items-center" @click="onBack">
<slot name="icon">
<ion-icon :icon="chevronBackOutline" class="text-2xl" />
</slot>
<span v-if="text" class="text-base">{{ text }}</span>
</button>
</template>
<style lang='css' scoped></style>