Files
WAI_Project_UNIX/components/custom-back.uvue
2026-01-21 01:37:34 +08:00

45 lines
912 B
Plaintext

<template>
<view class="custom-back" :style="{ top: top + 'px' }" @click="back">
<view class="back-icon">
<cl-icon name="arrow-left-line" :size="40" color="#333" />
</view>
</view>
</template>
<script setup lang="uts">
import { ref, onMounted } from 'vue';
import { router } from '@/cool';
const top = ref(0);
onMounted(() => {
const info = uni.getWindowInfo();
// 状态栏高度 + 适当的间距,通常胶囊按钮在该区域垂直居中
top.value = info.statusBarHeight + 6;
});
function back() {
router.back();
}
</script>
<style lang="scss" scoped>
.custom-back {
position: fixed;
left: 20rpx;
z-index: 999;
.back-icon {
width: 64rpx;
height: 64rpx;
background-color: rgba(255, 255, 255, 0.9);
border-radius: 32rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
border: 1rpx solid #eee;
}
}
</style>