File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ export function useBack ( ) {
2+ const router = useRouter ( )
3+
4+ function back ( ) {
5+ if ( history . length > 1 )
6+ router . back ( )
7+ else
8+ router . replace ( '/' )
9+ }
10+
11+ return { back }
12+ }
Original file line number Diff line number Diff line change 1010<script lang="ts" setup>
1111const { t } = useI18n ()
1212
13+ const { back } = useBack ()
14+
1315const title = computed (() => {
1416 return t (' page.about.title' )
1517})
@@ -27,5 +29,9 @@ useHead({
2729 <p >
2830 {{ t('app.description') }}
2931 </p >
32+ <TheButton mx-auto mt-4 @click =" back()" >
33+ <i i-carbon-return mr-2 />
34+ <span > {{ t('button.back') }}</span >
35+ </TheButton >
3036 </TheCard >
3137</template >
Original file line number Diff line number Diff line change 88 </route >
99
1010<script lang="ts" setup>
11+ const { t } = useI18n ()
12+
13+ const { back } = useBack ()
14+
1115const route = useRoute ()
1216
1317const title = computed (() => {
@@ -30,5 +34,9 @@ useHead({
3034 https://uvr.esm.is/guide/file-based-routing.html#dynamic-routes
3135 </a >
3236 </p >
37+ <TheButton mx-auto mt-4 @click =" back()" >
38+ <i i-carbon-return mr-2 />
39+ <span > {{ t('button.back') }}</span >
40+ </TheButton >
3341 </TheCard >
3442</template >
Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ declare global {
155155 const useAsyncQueue : typeof import ( '@vueuse/core' ) [ 'useAsyncQueue' ]
156156 const useAsyncState : typeof import ( '@vueuse/core' ) [ 'useAsyncState' ]
157157 const useAttrs : typeof import ( 'vue' ) [ 'useAttrs' ]
158+ const useBack : typeof import ( '../src/composables/back' ) [ 'useBack' ]
158159 const useBase64 : typeof import ( '@vueuse/core' ) [ 'useBase64' ]
159160 const useBattery : typeof import ( '@vueuse/core' ) [ 'useBattery' ]
160161 const useBluetooth : typeof import ( '@vueuse/core' ) [ 'useBluetooth' ]
@@ -493,6 +494,7 @@ declare module 'vue' {
493494 readonly useAsyncQueue : UnwrapRef < typeof import ( '@vueuse/core' ) [ 'useAsyncQueue' ] >
494495 readonly useAsyncState : UnwrapRef < typeof import ( '@vueuse/core' ) [ 'useAsyncState' ] >
495496 readonly useAttrs : UnwrapRef < typeof import ( 'vue' ) [ 'useAttrs' ] >
497+ readonly useBack : UnwrapRef < typeof import ( '../src/composables/back' ) [ 'useBack' ] >
496498 readonly useBase64 : UnwrapRef < typeof import ( '@vueuse/core' ) [ 'useBase64' ] >
497499 readonly useBattery : UnwrapRef < typeof import ( '@vueuse/core' ) [ 'useBattery' ] >
498500 readonly useBluetooth : UnwrapRef < typeof import ( '@vueuse/core' ) [ 'useBluetooth' ] >
You can’t perform that action at this time.
0 commit comments