chore:规范名字

This commit is contained in:
Free-sss 2025-09-08 15:05:16 +08:00
parent 417d458775
commit 67950643db
4 changed files with 37 additions and 34 deletions

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

View File

@ -6,67 +6,59 @@
{{ titleText }} {{ titleText }}
</span> </span>
<span class="right-select"> <span class="right-select">
<ConsumSelect v-show="selectOption.show" :options="selectOption.dataset" <ConsumSelect v-if="shouldShowSelect" :options="selectOption?.dataset || []"
:selectedValue="selectOption.selectValue" @change="handleSelectChange" :selectedValue="selectOption?.selectValue" @change="handleSelectChange"
:select-style-config="selectStyleConfig" /> :select-style-config="selectStyleConfig" />
</span> </span>
</div> </div>
<div class="content flex"> <div class="content flex">
<img src="./assets/Background.svg" alt="" class="svg ic"> <img src="./assets/Background.svg" alt="" class="svg ic">
<slot> <slot></slot>
</slot>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, PropType } from 'vue'
import ConsumSelect from './select.vue' import ConsumSelect from './select.vue'
interface SelectOption {
selectValue: string
dataset: Array<{
label: string
value: string
}>
}
const props = defineProps({ const props = defineProps({
titleText: { titleText: {
type: String, type: String,
required: true required: true
}, },
selectOption: { selectOption: {
type: Object, type: Object as PropType<SelectOption | null>,
default: () => ({ default: null
show: false,
selectValue: 'day',
dataset: [
{
label: '当天',
value: 'day'
}, },
{ selectStyleConfig: {
label: '本周',
value: 'week'
},
{
label: '当月',
value: 'month'
},
{
label: '本季度',
value: 'quarter'
},
{
label: '当年',
value: 'year'
}
]
})
}, selectStyleConfig: {
default: () => ({ default: () => ({
showAngle: true showAngle: true
}), }),
required: false required: false
} }
}) })
const emits = defineEmits(['change']) const emits = defineEmits(['change'])
const shouldShowSelect = computed(() => {
return props.selectOption !== null &&
props.selectOption !== undefined &&
Array.isArray(props.selectOption.dataset) &&
props.selectOption.dataset.length > 0
})
const handleSelectChange = (value: any) => { const handleSelectChange = (value: any) => {
emits('change', value) emits('change', value)
} }
</script> </script>
<style scoped> <style scoped>
@ -107,7 +99,18 @@ const handleSelectChange = (value: any) => {
text-shadow: 1px 3px 10px #000000; text-shadow: 1px 3px 10px #000000;
font-size: 16px; font-size: 16px;
/* background-color: #eee; */ /* background-color: #eee; */
max-width: 16em;
overflow: hidden;
text-overflow: ellipsis;
/* background-color: aliceblue; */
} }
.right-select {
margin-left: 70px;
margin-top: 8px;
z-index: 10;
}
} }
.content { .content {

View File

@ -76,7 +76,7 @@ onUnmounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.custom-select { .custom-select {
position: absolute; position: absolute;
top: 8px; top: 12px;
right: 14px; right: 14px;
font-size: 12px; font-size: 12px;
z-index: 1000; z-index: 1000;