|
|
@@ -1,57 +1,123 @@ |
|
|
<!-- --> |
|
|
<!-- --> |
|
|
<template> |
|
|
<template> |
|
|
<div class="about"> |
|
|
|
|
|
这是关于页面 |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="about"> |
|
|
|
|
|
<div v-for="item of list" |
|
|
|
|
|
:key="item" |
|
|
|
|
|
class="mt10">{{ item|friendlyTimeFilter }}</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="mt10"> |
|
|
|
|
|
<el-button class="" type="primary" icon="el-icon-download" size="mini" @click="downloadClick">下载代码</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) |
|
|
|
|
|
//例如:import 《组件名称》 from '《组件路径》'; |
|
|
|
|
|
export default { |
|
|
|
|
|
name: "About", |
|
|
|
|
|
props: {}, |
|
|
|
|
|
//import引入的组件需要注入到对象中才能使用 |
|
|
|
|
|
components: { |
|
|
|
|
|
//defaultPage , |
|
|
|
|
|
}, |
|
|
|
|
|
data() { |
|
|
|
|
|
return { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
//监听属性 类似于data概念 |
|
|
|
|
|
computed: { |
|
|
|
|
|
key() { |
|
|
|
|
|
return this.$route.fullPath |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
//监控data中的数据变化 |
|
|
|
|
|
watch: {}, |
|
|
|
|
|
//生命周期 - 创建完成(可以访问当前this实例) |
|
|
|
|
|
async created() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素) |
|
|
|
|
|
async mounted() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
//方法集合 |
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
//当前页面的filter |
|
|
|
|
|
filters: {} |
|
|
|
|
|
|
|
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) |
|
|
|
|
|
//例如:import 《组件名称》 from '《组件路径》'; |
|
|
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
|
export default { |
|
|
|
|
|
name: "About", |
|
|
|
|
|
props: {}, |
|
|
|
|
|
//import引入的组件需要注入到对象中才能使用 |
|
|
|
|
|
components: { |
|
|
|
|
|
//defaultPage , |
|
|
|
|
|
}, |
|
|
|
|
|
data () { |
|
|
|
|
|
return { |
|
|
|
|
|
list: [], |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
//监听属性 类似于data概念 |
|
|
|
|
|
computed: { |
|
|
|
|
|
key () { |
|
|
|
|
|
return this.$route.fullPath |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
//监控data中的数据变化 |
|
|
|
|
|
watch: {}, |
|
|
|
|
|
//生命周期 - 创建完成(可以访问当前this实例) |
|
|
|
|
|
async created () { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素) |
|
|
|
|
|
async mounted () { |
|
|
|
|
|
this.initList(); |
|
|
|
|
|
}, |
|
|
|
|
|
//方法集合 |
|
|
|
|
|
methods: { |
|
|
|
|
|
initList () { |
|
|
|
|
|
let list = []; |
|
|
|
|
|
let curr = dayjs(); |
|
|
|
|
|
list.push( |
|
|
|
|
|
curr.subtract(10, "s").unix() |
|
|
|
|
|
) |
|
|
|
|
|
list.push( |
|
|
|
|
|
curr.subtract(10, "m").unix() |
|
|
|
|
|
) |
|
|
|
|
|
list.push( |
|
|
|
|
|
curr.subtract(62, "m").unix() |
|
|
|
|
|
) |
|
|
|
|
|
list.push( |
|
|
|
|
|
curr.subtract(10, "h").unix() |
|
|
|
|
|
) |
|
|
|
|
|
list.push( |
|
|
|
|
|
curr.subtract(10, "day").unix() |
|
|
|
|
|
) |
|
|
|
|
|
list.push( |
|
|
|
|
|
curr.subtract(1, "year").unix() |
|
|
|
|
|
) |
|
|
|
|
|
this.list = list; |
|
|
|
|
|
}, |
|
|
|
|
|
downloadClick(){ |
|
|
|
|
|
window.open("/code.txt") |
|
|
|
|
|
// window.location.href = "/code.txt" |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
//当前页面的filter |
|
|
|
|
|
filters: { |
|
|
|
|
|
friendlyTimeFilter (val) { |
|
|
|
|
|
if (!val) { |
|
|
|
|
|
return "--"; |
|
|
|
|
|
} |
|
|
|
|
|
let length = `${val}`.length; |
|
|
|
|
|
if (length != 13 && length != 10) { |
|
|
|
|
|
return "--"; |
|
|
|
|
|
} |
|
|
|
|
|
if (length == 13) { |
|
|
|
|
|
val = parseInt(val / 1000); |
|
|
|
|
|
} |
|
|
|
|
|
let valObj = dayjs(val * 1000); |
|
|
|
|
|
let currObj = dayjs(); |
|
|
|
|
|
if (!valObj.isSame(currObj, "year")) { |
|
|
|
|
|
return valObj.format("MMM DD,YYYY") |
|
|
|
|
|
} |
|
|
|
|
|
let curr = currObj.unix(); |
|
|
|
|
|
let diff = curr - val; |
|
|
|
|
|
if (diff < 60) { |
|
|
|
|
|
return "a minute ago"; |
|
|
|
|
|
} else if (diff < 60 * 60) { |
|
|
|
|
|
return `${parseInt(diff / 60)} minutes ago`; |
|
|
|
|
|
} else if (diff < 60 * 60 * 2) { |
|
|
|
|
|
return `a hour ago`; |
|
|
|
|
|
} else if (diff < 60 * 60 * 24) { |
|
|
|
|
|
return `${parseInt(diff / (60 * 60))} hours ago`; |
|
|
|
|
|
} |
|
|
|
|
|
return valObj.format("MMM DD") |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
<!-- 单页私有css --> |
|
|
<!-- 单页私有css --> |
|
|
<style scoped> |
|
|
<style scoped> |
|
|
.about { |
|
|
|
|
|
padding: 30px; |
|
|
|
|
|
background-color: #fff; |
|
|
|
|
|
border-radius: 4px; |
|
|
|
|
|
min-height: 600px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.about { |
|
|
|
|
|
padding: 30px; |
|
|
|
|
|
background-color: #fff; |
|
|
|
|
|
border-radius: 4px; |
|
|
|
|
|
min-height: 600px; |
|
|
|
|
|
} |
|
|
|
|
|
.mt10 { |
|
|
|
|
|
margin-top: 10px; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
<style> |
|
|
<style> |
|
|
</style> |
|
|
</style> |