no message
Former-commit-id: cd83c023d354b95d2f40566de248325ec404e71b Former-commit-id: a5d857b37e8a93170e75e9e70fba63f0b3af3b06 Former-commit-id: c94bef7e8d329f33ea2721d87f730a1461c6eef8
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
"papaparse": "^4.3.6",
|
||||
"quill": "^1.3.4",
|
||||
"simplemde": "^1.11.2",
|
||||
"timeago.js": "^3.0.2",
|
||||
"vue": "^2.5.2",
|
||||
"vue-grid-layout": "^2.1.11",
|
||||
"vue-router": "^3.0.1",
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
// 注意 这个文件里只写class
|
||||
// mixin等内容请在 public.scss 里书写
|
||||
|
||||
// 文字相关
|
||||
.#{$prefix}-text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
// 浮动相关
|
||||
.#{$prefix}-fl {
|
||||
|
||||
73
src/pages/demo/plugins/timeago/demo.vue
Normal file
73
src/pages/demo/plugins/timeago/demo.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<Container type="ghost">
|
||||
<el-card class="dd-mb">
|
||||
<PageHeader
|
||||
title="基本示例"
|
||||
url="https://github.com/hustcc/timeago.js">
|
||||
</PageHeader>
|
||||
</el-card>
|
||||
<el-card class="dd-mb">
|
||||
<div class="dd-text-center">
|
||||
<h1 style="font-size: 30px;">您在{{openPageDateAgo}}打开的此页面</h1>
|
||||
<p style="font-size: 10px;">请稍等一下 会自动刷新</p>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="dd-mb">
|
||||
<div class="dd-text-center">
|
||||
<h1 style="font-size: 30px;">{{dateTimeRangeAgo}}</h1>
|
||||
<el-date-picker
|
||||
v-model="dateTimeRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<Markdown url="/static/markdownFiles/article/timeago演示代码.md"></Markdown>
|
||||
</el-card>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import timeago from 'timeago.js'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
// 打开页面时间
|
||||
openPageDate: new Date(),
|
||||
// 打开页面已经过去的时间
|
||||
openPageDateAgo: '',
|
||||
// 起止时间
|
||||
dateTimeRange: [new Date(2018, 0, 1, 0, 0), new Date()],
|
||||
// 上面起止时间的计算结果
|
||||
dateTimeRangeAgo: ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
// 刷新打开页面过去的时间
|
||||
this.refreshOpenPageDateAgo()
|
||||
setInterval(this.refreshOpenPageDateAgo, 1000)
|
||||
// 刷新起止时间的计算结果
|
||||
this.refreshDateTimeRangeAgo()
|
||||
},
|
||||
watch: {
|
||||
dateTimeRange () {
|
||||
// 刷新起止时间的计算结果
|
||||
this.refreshDateTimeRangeAgo()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 计算打开页面过了多久
|
||||
refreshOpenPageDateAgo () {
|
||||
this.openPageDateAgo = timeago().format(this.openPageDate, 'zh_CN')
|
||||
},
|
||||
// 计算起止时间间隔
|
||||
refreshDateTimeRangeAgo () {
|
||||
const timeagoInstance = timeago(this.dateTimeRange[1])
|
||||
this.dateTimeRangeAgo = timeagoInstance.format(this.dateTimeRange[0], 'zh_CN')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -71,17 +71,17 @@ export const pluginMenu = {
|
||||
}
|
||||
]
|
||||
},
|
||||
// 可调布局组件
|
||||
// 时间计算
|
||||
{
|
||||
title: '可调布局',
|
||||
icon: 'object-group',
|
||||
title: '时间计算',
|
||||
icon: 'clock-o',
|
||||
children: [
|
||||
{
|
||||
title: '基本示例',
|
||||
icon: 'file-o',
|
||||
path: 'vue-splitpane/demo',
|
||||
name: 'demo-plugin-vue-splitpane-demo',
|
||||
component: resolve => { require(['@/pages/demo/plugins/vue-splitpane/demo.vue'], resolve) }
|
||||
path: 'timeago/demo',
|
||||
name: 'demo-plugin-timeago-demo',
|
||||
component: resolve => { require(['@/pages/demo/plugins/timeago/demo.vue'], resolve) }
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -182,6 +182,20 @@ export const pluginMenu = {
|
||||
component: resolve => { require(['@/pages/demo/plugins/mock/ajax.vue'], resolve) }
|
||||
}
|
||||
]
|
||||
},
|
||||
// 可调布局组件
|
||||
{
|
||||
title: '可调布局',
|
||||
icon: 'object-group',
|
||||
children: [
|
||||
{
|
||||
title: '基本示例',
|
||||
icon: 'file-o',
|
||||
path: 'vue-splitpane/demo',
|
||||
name: 'demo-plugin-vue-splitpane-demo',
|
||||
component: resolve => { require(['@/pages/demo/plugins/vue-splitpane/demo.vue'], resolve) }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
41
static/markdownFiles/article/timeago演示代码.md
Normal file
41
static/markdownFiles/article/timeago演示代码.md
Normal file
@@ -0,0 +1,41 @@
|
||||
```
|
||||
import timeago from 'timeago.js'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
// 打开页面时间
|
||||
openPageDate: new Date(),
|
||||
// 打开页面已经过去的时间
|
||||
openPageDateAgo: '',
|
||||
// 起止时间
|
||||
dateTimeRange: [new Date(2018, 0, 1, 0, 0), new Date()],
|
||||
// 上面起止时间的计算结果
|
||||
dateTimeRangeAgo: ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
// 刷新打开页面过去的时间
|
||||
this.refreshOpenPageDateAgo()
|
||||
setInterval(this.refreshOpenPageDateAgo, 1000)
|
||||
// 刷新起止时间的计算结果
|
||||
this.refreshDateTimeRangeAgo()
|
||||
},
|
||||
watch: {
|
||||
dateTimeRange () {
|
||||
// 刷新起止时间的计算结果
|
||||
this.refreshDateTimeRangeAgo()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 计算打开页面过了多久
|
||||
refreshOpenPageDateAgo () {
|
||||
this.openPageDateAgo = timeago().format(this.openPageDate, 'zh_CN')
|
||||
},
|
||||
// 计算起止时间间隔
|
||||
refreshDateTimeRangeAgo () {
|
||||
const timeagoInstance = timeago(this.dateTimeRange[1])
|
||||
this.dateTimeRangeAgo = timeagoInstance.format(this.dateTimeRange[0], 'zh_CN')
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user