25 lines
574 B
Vue
25 lines
574 B
Vue
<template>
|
|
<button
|
|
@click="handleBack"
|
|
class="flex items-center gap-2 px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg transition-colors"
|
|
>
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
|
|
</svg>
|
|
<span>返回</span>
|
|
</button>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const router = useRouter()
|
|
|
|
function handleBack() {
|
|
if (window.history.length > 1) {
|
|
router.back()
|
|
} else {
|
|
router.push('/')
|
|
}
|
|
}
|
|
</script>
|
|
|