10 changed files with 59 additions and 83 deletions
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3.2 KiB |
@ -0,0 +1,3 @@
|
||||
import BackOperation from './src/index.vue' |
||||
|
||||
export { BackOperation } |
@ -0,0 +1,30 @@
|
||||
<script lang="ts" setup> |
||||
import { Icon } from '@/components/Icon' |
||||
import { propTypes } from '@/utils/propTypes' |
||||
import { onBeforeRouteUpdate } from 'vue-router' |
||||
defineOptions({ name: 'BackOperation' }) |
||||
|
||||
const router = useRouter() |
||||
const isBack = ref(false) |
||||
defineProps({ |
||||
color: propTypes.string.def('') |
||||
}) |
||||
|
||||
const goback = () => { |
||||
router.go(-1) |
||||
} |
||||
onBeforeRouteUpdate((to) => { |
||||
isBack.value = to.meta.hidden |
||||
}) |
||||
</script> |
||||
|
||||
<template> |
||||
<div |
||||
@click="goback" |
||||
class="flex items-center gap-4px color-#409EFF cursor-pointer" |
||||
v-show="isBack" |
||||
> |
||||
<Icon icon="ep:back" :size="18" /> |
||||
<span class="text-14px line-height-22px"> 返回上一级 </span> |
||||
</div> |
||||
</template> |
Loading…
Reference in new issue