移除无用的时间函数
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
import { request, type BaseResponseData } from '@/lib/request';
|
import { request, type BaseResponseData } from '@/lib/request';
|
||||||
import { computed, onMounted, reactive, ref, watch, watchEffect } from 'vue';
|
import { computed, onMounted, reactive, ref, watch, watchEffect } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { timestampToString } from '@/lib/timestampToString';
|
|
||||||
const model = defineModel();
|
const model = defineModel();
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const bloguuid = route.params.uuid;
|
const bloguuid = route.params.uuid;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { onMounted, reactive, ref, type Ref } from 'vue';
|
import { onMounted, reactive, ref, type Ref } from 'vue';
|
||||||
import { request, type BaseResponseData } from '../../lib/request'
|
import { request, type BaseResponseData } from '../../lib/request'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { timestampToString } from '@/lib/timestampToString';
|
|
||||||
const tableData: Ref<any[]> = ref([])
|
const tableData: Ref<any[]> = ref([])
|
||||||
const dialogEditFormVisible = ref(false);
|
const dialogEditFormVisible = ref(false);
|
||||||
type BlogContentData = {
|
type BlogContentData = {
|
||||||
|
|||||||
@@ -1,21 +1,3 @@
|
|||||||
|
|
||||||
function timestampToString(timestamp: string | number) {
|
|
||||||
if (timestamp === undefined || timestamp === null) {
|
|
||||||
throw new Error('Timestamp cannot be undefined or null');
|
|
||||||
}
|
|
||||||
|
|
||||||
const date = new Date(+timestamp);
|
|
||||||
|
|
||||||
const year = date.getFullYear();
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // getMonth() returns 0-11, so we add 1
|
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
||||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
||||||
|
|
||||||
return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function timestampToRelativeWeekday(timestamp: string | number) {
|
function timestampToRelativeWeekday(timestamp: string | number) {
|
||||||
if (timestamp === undefined || timestamp === null) {
|
if (timestamp === undefined || timestamp === null) {
|
||||||
throw new Error('Timestamp cannot be undefined or null');
|
throw new Error('Timestamp cannot be undefined or null');
|
||||||
@@ -43,4 +25,4 @@ function timestampToRelativeWeekday(timestamp: string | number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { timestampToString, timestampToRelativeWeekday }
|
export { timestampToRelativeWeekday }
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { request, type BaseResponseData } from '@/lib/request';
|
import { request, type BaseResponseData } from '@/lib/request';
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { timestampToString } from '../lib/timestampToString'
|
|
||||||
import { formateTimes } from '@/lib/formateTimes';
|
import { formateTimes } from '@/lib/formateTimes';
|
||||||
const loadStatus = ref(0);
|
const loadStatus = ref(0);
|
||||||
const blogList: any[] = reactive([]);
|
const blogList: any[] = reactive([]);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { request, type BaseResponseData } from '@/lib/request';
|
import { request, type BaseResponseData } from '@/lib/request';
|
||||||
import { onMounted, onUnmounted, ref, type Ref } from 'vue';
|
import { onMounted, onUnmounted, ref, type Ref } from 'vue';
|
||||||
import { timestampToString } from '../lib/timestampToString'
|
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { Marked } from 'marked';
|
import { Marked } from 'marked';
|
||||||
import { markedHighlight } from "marked-highlight";
|
import { markedHighlight } from "marked-highlight";
|
||||||
|
|||||||
Reference in New Issue
Block a user