automated_uniapp/uni_modules/cool-fixtures/components/fix-title/fix-title.vue
2025-01-09 16:40:44 +08:00

130 lines
2.2 KiB
Vue

<template>
<fix-base-style
:styleSpacing="styleSpacing"
:styleColor="styleColor"
:position="position"
:index="index"
>
<view class="fix-title">
<view class="inner">
<view class="left" @click="toPath(left.link)">
<image v-if="left.icon" :src="left.icon" class="icon" />
<view class="text" :style="{ color: left.color }" :class="[`is-${mode}`]">
{{ left.text }}
</view>
</view>
<view class="right" @click="toPath(right.link)">
<text class="text" :style="{ color: right.color }">{{ right.text }}</text>
<image v-if="right.icon" :src="right.icon" class="icon" />
</view>
</view>
</view>
</fix-base-style>
</template>
<script lang="ts" name="fix-title" setup>
import { type PropType } from "vue";
import type { Form } from "../../types/form";
import { baseProps } from "../../hooks";
const props = defineProps({
mode: {
type: String,
default: "left",
},
left: {
type: Object as PropType<Form.Title>,
default: () => {
return {
text: "标题内容",
color: "#000",
icon: "",
link: {
name: "",
type: "",
appid: "",
page: "",
},
};
},
},
right: {
type: Object as PropType<Form.Title>,
default: () => {
return {
text: "查看",
color: "#a8abb2",
icon: "",
link: {
name: "",
type: "",
appid: "",
page: "",
},
};
},
},
index: {
type: Number,
default: 0,
},
...baseProps,
});
const emits = defineEmits(["jump"]);
function toPath(link: Form.Link) {
emits("jump", link);
}
</script>
<style lang="scss" scoped>
.fix-title {
box-sizing: border-box;
overflow: hidden;
.inner {
height: 80rpx;
flex: 1;
display: flex;
align-items: center;
justify-content: space-around;
padding: 20rpx;
.left {
display: flex;
align-items: center;
flex: 1;
.icon {
margin-right: 20rpx;
width: 60rpx;
height: 60rpx;
}
.text {
flex: 1;
font-size: 32rpx;
font-weight: bold;
}
.is-left {
text-align: left;
}
.is-center {
text-align: center;
}
}
.right {
display: flex;
justify-content: flex-end;
align-items: center;
.icon {
margin-left: 20rpx;
width: 40rpx;
height: 40rpx;
}
.text {
font-size: 24rpx;
}
}
}
}
</style>