element-plus/docs/examples/statistic/countdown.vue
qiang 7b6e2c2600
docs: rendering example demos on the server side (#17472)
* docs: rendering example demos on the server side

* fix: render error

* chore: update dependencies

* chore: return all teleports
2024-08-22 14:33:13 +08:00

55 lines
1.3 KiB
Vue

<template>
<el-row>
<el-col :span="8">
<el-countdown title="Start to grab" :value="value" />
</el-col>
<el-col :span="8">
<el-countdown
title="Remaining VIP time"
format="HH:mm:ss"
:value="value1"
/>
<el-button class="countdown-footer" type="primary" @click="reset">
Reset
</el-button>
</el-col>
<el-col :span="8">
<el-countdown format="DD [days] HH:mm:ss" :value="value2">
<template #title>
<div style="display: inline-flex; align-items: center">
<el-icon style="margin-right: 4px" :size="12">
<Calendar />
</el-icon>
Still to go until next month
</div>
</template>
</el-countdown>
<div class="countdown-footer">{{ value2.format('YYYY-MM-DD') }}</div>
</el-col>
</el-row>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import dayjs from 'dayjs'
import { Calendar } from '@element-plus/icons-vue'
const value = ref(Date.now() + 1000 * 60 * 60 * 7)
const value1 = ref(Date.now() + 1000 * 60 * 60 * 24 * 2)
const value2 = ref(dayjs().add(1, 'month').startOf('month'))
function reset() {
value1.value = Date.now() + 1000 * 60 * 60 * 24 * 2
}
</script>
<style scoped>
.el-col {
text-align: center;
}
.countdown-footer {
margin-top: 8px;
}
</style>