no message
Former-commit-id: 502361a526f041cfc2b1f1f53f8d8d47a98c06ee Former-commit-id: 1b167310e861bf5f7223106f5c148ebf21f01223 Former-commit-id: 6910d7543f0f0bfd3ede6767e09aea7b6fe67349 Former-commit-id: 6f704941663129079269f8f6c6f1d18a1256fe06
This commit is contained in:
@@ -1,6 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<d2-container type="full">
|
<d2-container type="full">
|
||||||
<template slot="header">日期计算</template>
|
<template slot="header">
|
||||||
|
<el-button @click="handleReset">重新设置基础时间 this.now = dayjs()</el-button>
|
||||||
|
</template>
|
||||||
|
<h1>当前时间</h1>
|
||||||
|
<el-row :gutter="20" class="d2-mt">
|
||||||
|
<el-col :span="8"><el-card shadow="never"><d2-highlight slot="header" :code="`now.format()`"/>{{now.format()}}</el-card></el-col>
|
||||||
|
</el-row>
|
||||||
|
<h1>获取</h1>
|
||||||
|
<el-row :gutter="20" class="d2-mt">
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.year()`"/>{{now.year()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.month()`"/>{{now.month()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.date()`"/>{{now.date()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.day()`"/>{{now.day()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.hour()`"/>{{now.hour()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.minute()`"/>{{now.minute()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.second()`"/>{{now.second()}}</el-card></el-col>
|
||||||
|
<el-col :span="6"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.millisecond()`"/>{{now.millisecond()}}</el-card></el-col>
|
||||||
|
</el-row>
|
||||||
|
<h1>设置</h1>
|
||||||
|
<el-row :gutter="20" class="d2-mt">
|
||||||
|
<el-col :span="8"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.set('month', 6).month()`"/>{{now.set('month', 6).month()}}</el-card></el-col>
|
||||||
|
<el-col :span="8"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.set('second', 30).second()`"/>{{now.set('second', 30).second()}}</el-card></el-col>
|
||||||
|
<el-col :span="8"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.set('hour', 4).hour()`"/>{{now.set('hour', 4).hour()}}</el-card></el-col>
|
||||||
|
</el-row>
|
||||||
|
<h1>操作</h1>
|
||||||
|
<el-row :gutter="20" class="d2-mt">
|
||||||
|
<el-col :span="12"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.add(1, 'day').format()`"/>{{now.add(1, 'day').format()}}</el-card></el-col>
|
||||||
|
<el-col :span="12"><el-card shadow="never" class="d2-mb"><d2-highlight slot="header" :code="`now.subtract(7, 'year').format()`"/>{{now.subtract(7, 'year').format()}}</el-card></el-col>
|
||||||
|
</el-row>
|
||||||
<template slot="footer">
|
<template slot="footer">
|
||||||
<d2-demo-link-btn title="依赖" :link="link"/>
|
<d2-demo-link-btn title="依赖" :link="link"/>
|
||||||
</template>
|
</template>
|
||||||
@@ -12,7 +40,13 @@ import dayjs from 'dayjs'
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
link: 'https://github.com/iamkun/dayjs'
|
link: 'https://github.com/iamkun/dayjs',
|
||||||
|
now: dayjs()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleReset () {
|
||||||
|
this.now = dayjs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user