前端通用工具函数
点击复制文本
<button @click="copyText('文案内容')">复制</button>
const { copyText } = commonFunction();
格式化时间
- html 代码中直接使用 parseDate parseTime 进行格式化
<el-table-column
:label="t('tenant.startTime')"
prop="startTime"
show-overflow-tooltip
>
<template #default="scope">
<span>{{ parseDate(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column
:label="t('tenant.endTime')"
prop="endTime"
show-overflow-tooltip
>
<template #default="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
- ts 中需要手动导入
import { formatDate, parseDate } from "/@/utils/formatTime";
♥️ 获取支持
遇到问题?
如果您在使用过程中遇到任何问题、有功能建议或需求,请点击此卡片前往 Gitee 仓库提交 Issue。