第一次提交

This commit is contained in:
2026-06-03 14:18:28 +08:00
parent 6c304749b0
commit 1f1581321c
51 changed files with 4385 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import type { Ref } from "vue";
import { computed } from "vue";
export default function useFileNameParser(name: Ref<string | undefined>) {
const namePrefix = computed(() => {
const nameStr = name.value || "";
const lastDotIndex = nameStr.lastIndexOf(".");
return lastDotIndex === -1 ? nameStr : nameStr.slice(0, lastDotIndex);
});
const nameSuffix = computed(() => {
const nameStr = name.value || "";
const lastDotIndex = nameStr.lastIndexOf(".");
if (lastDotIndex === -1 && nameStr.length - lastDotIndex > 10) {
// 文件名长度超过10个字符 显示.file
return ".file";
}
return lastDotIndex === -1 ? "" : nameStr.slice(lastDotIndex);
});
return {
namePrefix,
nameSuffix
};
}