docs(components): check docs before stable (#5740)

This commit is contained in:
C.Y.Kun
2022-01-31 23:43:56 +08:00
committed by GitHub
parent 4501b6dd66
commit b46bdae9e6
103 changed files with 1244 additions and 767 deletions

View File

@ -49,8 +49,39 @@
<script lang="ts" setup>
import { ref } from 'vue'
import dayjs from 'dayjs'
const loading = ref(false)
const currentDate = dayjs().format('YYYY-MM-DD')
const currentDate = formatDate(new Date(), 'yyyy-MM-dd')
function formatDate(date: string | Date, fmt: string) {
if (typeof date == 'string') {
return date
}
if (!fmt) fmt = 'yyyy-MM-dd hh:mm:ss'
if (!date || date == null) return null
const o = {
'M+': date.getMonth() + 1, // 月份
'd+': date.getDate(), // 日
'h+': date.getHours(), // 小时
'm+': date.getMinutes(), // 分
's+': date.getSeconds(), // 秒
'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
S: date.getMilliseconds(), // 毫秒
}
if (/(y+)/.test(fmt))
fmt = fmt.replace(
RegExp.$1,
`${date.getFullYear()}`.substr(4 - RegExp.$1.length)
)
for (const k in o) {
if (new RegExp(`(${k})`).test(fmt))
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length === 1 ? o[k] : `00${o[k]}`.substr(`${o[k]}`.length)
)
}
return fmt
}
</script>