refactor time-label

This commit is contained in:
Timi
2026-10-21 11:25:05 +08:00
parent 5b4f588cfb
commit 929ba4d0e1
10 changed files with 52 additions and 49 deletions
-1
View File
@@ -9,5 +9,4 @@ CenterTips.install = (app: App) => {
};
/** 兼容旧组件名。 */
export const EmptyTips = CenterTips;
export default CenterTips;
+4 -5
View File
@@ -5,11 +5,11 @@ import HoverPopup, { VPopupComponent } from "./v-popup";
import Captcha from "./captcha";
import Loading from "./loading";
import Copyright from "./copyright";
import CenterTips, { EmptyTips } from "./center-tips";
import CenterTips from "./center-tips";
import MarkdownView from "./markdown-view";
import BEFlowerFall from "./background-effect/flower-fall";
import MarkdownEditor from "./markdown-editor";
import PassTimeLabel from "./passtime-label";
import TimeLabel from "./time-label";
import ContactNumber from "./contact-number";
import AnimatedNumber from "./animated-number";
import AnimatedAmount from "./animated-amount";
@@ -26,7 +26,7 @@ export default [
MarkdownView,
BEFlowerFall,
MarkdownEditor,
PassTimeLabel,
TimeLabel,
ContactNumber,
AnimatedNumber,
AnimatedAmount,
@@ -42,11 +42,10 @@ export {
Loading,
Copyright,
CenterTips,
EmptyTips,
MarkdownView,
BEFlowerFall,
MarkdownEditor,
PassTimeLabel,
TimeLabel,
ContactNumber,
AnimatedNumber,
AnimatedAmount,
-5
View File
@@ -1,5 +0,0 @@
import view from "./index.vue";
import WebToolkit from "../../utils/WebToolkit";
export const PassTimeLabel = WebToolkit.withInstall(view);
export default PassTimeLabel;
+5
View File
@@ -0,0 +1,5 @@
import view from "./index.vue";
import WebToolkit from "../../utils/WebToolkit";
export const TimeLabel = WebToolkit.withInstall(view);
export default TimeLabel;
@@ -1,7 +1,7 @@
<template>
<span
v-if="currentTimestamp"
class="tui-passtime-label"
class="tui-time-label"
:class="{ underline }"
role="button"
tabindex="0"
@@ -15,7 +15,7 @@
import { Time } from "timi-ts";
defineOptions({
name: "PassTimeLabel"
name: "TimeLabel"
});
const props = withDefaults(defineProps<{
@@ -42,7 +42,7 @@ const currentTimestamp = computed(() => {
const content = computed(() => {
if (!showingDetail.value) {
return Time.toPassedDateTime(currentTimestamp.value);
return Time.formatDateTime(currentTimestamp.value);
}
if (onlyTime.value) {
return Time.toTime(currentTimestamp.value);
@@ -61,7 +61,7 @@ function toggle(event: MouseEvent | KeyboardEvent): void {
</script>
<style lang="less" scoped>
.tui-passtime-label {
.tui-time-label {
cursor: pointer;
&.underline {