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
54 lines
1.1 KiB
Vue
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>
|