build: 添加 Vite 配置文件

- 新增 vite.config.ts 文件
- 配置 Vue、TailwindCSS 和 Autoprefixer插件
- 设置别名路径和 CSS 处理方式
This commit is contained in:
唐杰
2025-04-24 09:17:16 +08:00
parent 8423a79b9d
commit 83e4f017e9
+43 -2
View File
@@ -82,11 +82,52 @@ export const copyRetrieveCode = async (code: string): Promise<boolean> => {
const baseUrl = window.location.origin + '/#/'; const baseUrl = window.location.origin + '/#/';
export const copyWgetCommand = (retrieveCode: string, fileName: any) => { /*export const copyWgetCommand = (retrieveCode: string, fileName: any) => {
const command = `wget ${baseUrl}?code=${retrieveCode} -O "${fileName}"`; //wget https://share.lanol.cn/share/select?code=17634
const command = `wget ${baseUrl}share/select?code=${retrieveCode} -O "${fileName}"`;
navigator.clipboard.writeText(command).then(() => { navigator.clipboard.writeText(command).then(() => {
alertStore.showAlert('wget命令已复制到剪贴板', 'success'); alertStore.showAlert('wget命令已复制到剪贴板', 'success');
}).catch(() => { }).catch(() => {
alertStore.showAlert('复制wget命令失败', 'error'); alertStore.showAlert('复制wget命令失败', 'error');
}); });
};*/
export const copyWgetCommand = (retrieveCode: string, fileName: string) => {
// const command = `wget ${window.location.origin}/download/${retrieveCode} -O ${filename}`;
const command = `wget ${baseUrl}share/select?code=${retrieveCode} -O "${fileName}"`;
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(command)
.then(() => {
console.log("命令已复制到剪贴板!");
})
.catch((err) => {
console.error("复制失败,使用回退方法:", err);
fallbackCopyTextToClipboard(command);
});
} else {
console.warn("Clipboard API 不可用,使用回退方法。");
fallbackCopyTextToClipboard(command);
}
}; };
function fallbackCopyTextToClipboard(text:string) {
const textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.position = "fixed"; // 避免滚动
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
const successful = document.execCommand("copy");
console.log("回退复制操作成功:", successful);
} catch (err) {
console.error("回退复制操作失败:", err);
}
document.body.removeChild(textArea);
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText("要复制的文本");
} else {
fallbackCopyTextToClipboard("要复制的文本");
}