mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +08:00
83 lines
2.5 KiB
Vue
83 lines
2.5 KiB
Vue
<template>
|
|
<el-space direction="vertical" alignment="flex-start">
|
|
<div>
|
|
<label style="margin-right: 16px">Switch Loading</label>
|
|
<el-switch v-model="loading" />
|
|
</div>
|
|
<el-skeleton style="width: 240px" :loading="loading" animated>
|
|
<template #template>
|
|
<el-skeleton-item variant="image" style="width: 240px; height: 240px" />
|
|
<div style="padding: 14px">
|
|
<el-skeleton-item variant="h3" style="width: 50%" />
|
|
<div
|
|
style="
|
|
display: flex;
|
|
align-items: center;
|
|
justify-items: space-between;
|
|
margin-top: 16px;
|
|
height: 16px;
|
|
"
|
|
>
|
|
<el-skeleton-item variant="text" style="margin-right: 16px" />
|
|
<el-skeleton-item variant="text" style="width: 30%" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<template #default>
|
|
<el-card :body-style="{ padding: '0px', marginBottom: '1px' }">
|
|
<img
|
|
src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
|
|
class="image"
|
|
/>
|
|
<div style="padding: 14px">
|
|
<span>Delicious hamburger</span>
|
|
<div class="bottom card-header">
|
|
<span class="time">{{ currentDate }}</span>
|
|
<el-button type="text" class="button">Operation button</el-button>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</template>
|
|
</el-skeleton>
|
|
</el-space>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
|
|
const loading = ref(true)
|
|
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>
|