init
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view class="cardTitle p-x-20 cardBg" :style="{ height: statusBarHeight + 44 + 'px' }">
|
||||
<view :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<view class="flex-center ju-between h_88">
|
||||
<view class="cardLeft" v-if="props.showLeftButton">
|
||||
<view @tap="onClickLeft">
|
||||
<uni-icons type="left" :color="textColor" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{
|
||||
props.title
|
||||
}}</view>
|
||||
<view> </view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
bg: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
scrollbg: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 20,
|
||||
},
|
||||
showLeftButton: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333333',
|
||||
},
|
||||
scrollColor: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
goLeft: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: '/pages/index/index',
|
||||
},
|
||||
back: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
const hasHistory = sheep.$router.hasHistory();
|
||||
const emits = defineEmits(['navback', 'clickLeft']);
|
||||
const onClickLeft = () => {
|
||||
if (props.goLeft) {
|
||||
if (hasHistory) {
|
||||
uni.navigateBack({ delta: props.back });
|
||||
} else {
|
||||
sheep.$router.go(props.url);
|
||||
}
|
||||
} else {
|
||||
emits('clickLeft');
|
||||
}
|
||||
};
|
||||
// 监听滚动事件
|
||||
let scrollTop = ref(0);
|
||||
let backgroundColor = ref(props.bg);
|
||||
let textColor = ref(props.color);
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.cardTitle {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
.cardBg {
|
||||
// 背景图片顶部显示, 超出部分隐藏, 宽等于100%
|
||||
background-color: #ffffff;
|
||||
}
|
||||
:deep(.uniui-left) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
.cardLeft {
|
||||
position: absolute;
|
||||
bottom: 44rpx;
|
||||
left: 20rpx;
|
||||
transform: translateY(50%);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user