chat-app/src/components/x-date-select/index.vue
scout b54bfe63ad
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
init
2024-11-11 14:46:14 +08:00

54 lines
1.1 KiB
Vue

<script setup>
import { computed } from 'vue';
import dayjs from 'dayjs';
import {theme} from "@/config/theme";
const props = defineProps({
format: {
type: String,
default: 'YYYY-MM-DD'
},
value: {
type: String,
default: ''
},
showSuffix:{
type: Object,
default: () => {
return{ year: '年', month: '月', day: '日', hour: '时', minute: '分', second: '秒' }
}
},
show: {
type: Boolean,
default: false
},
onConfirm: Function,
})
const showDetail = computed(() => ({
year: props.format.includes('YYYY'),
month: props.format.includes('MM'),
day: props.format.includes('DD'),
hour: props.format.includes('HH'),
minute: props.format.includes('mm'),
second: props.format.includes('ss'),
ampm: props.format.includes('A'),
}))
const defaultValue = computed(() => dayjs(`${props.value}-01-01`).valueOf());
</script>
<template>
<tm-time-picker
:showDetail="showDetail"
:show="show"
:model-str="value"
:default-value="defaultValue"
:color="theme.colors.primary"
v-bind="{...$props,...$attrs}"
/>
</template>
<style scoped lang="scss">
</style>