diff --git a/src/components/WebInfo/WebInfo.vue b/src/components/WebInfo/WebInfo.vue
index 2f83c46..fa16dae 100644
--- a/src/components/WebInfo/WebInfo.vue
+++ b/src/components/WebInfo/WebInfo.vue
@@ -1,8 +1,10 @@
@@ -68,31 +74,24 @@ const copyRes = async (resStr: string) => {
-
- 域名:
+ 域名:
{{ searchUrl }}
-
- logo:
+ logo:
- 下载
+ 下载
-
- 标题:
-
- {{ toolsStore.webInfo.title }}
+ 标题: {{ toolsStore.webInfo.title }}
-
- 关键词:
-
- {{ toolsStore.webInfo.keywords }}
+ 关键词: {{ toolsStore.webInfo.keywords }}
-
- 描述:
-
- {{ toolsStore.webInfo.desc }}
-
+ 描述: {{ toolsStore.webInfo.desc }}
diff --git a/src/utils/file.ts b/src/utils/file.ts
index 18eb8fd..9bced20 100644
--- a/src/utils/file.ts
+++ b/src/utils/file.ts
@@ -26,6 +26,7 @@ export function base64ToBlod(base64String: string): string {
export function autoDown(url: string, filename: string) {
const downloadLink = document.createElement('a');
downloadLink.href = url;
+ downloadLink.target = '_blank';
downloadLink.download = filename; // 指定下载的文件名
// 将下载链接添加到 DOM 中并模拟点击下载
document.body.appendChild(downloadLink);
@@ -33,8 +34,20 @@ export function autoDown(url: string, filename: string) {
document.body.removeChild(downloadLink);
}
+/**
+ * 获取文件后缀
+ */
+export function getFileExtension(filename) {
+ const dotIndex = filename.lastIndexOf('.');
+ if (dotIndex === -1) {
+ return ''; // 没有找到'.',返回空字符串
+ }
+ return filename.substr(dotIndex + 1); // 返回'.'之后的部分作为后缀名
+}
+
const FileUtils = {
base64ToBlod,
- autoDown
+ autoDown,
+ getFileExtension
}
export default FileUtils
\ No newline at end of file
diff --git a/src/utils/url.ts b/src/utils/url.ts
index 1382414..977857a 100644
--- a/src/utils/url.ts
+++ b/src/utils/url.ts
@@ -11,4 +11,10 @@ export function isUrl(str: string): boolean {
'^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,})','i'); // fragment locator
return urlPattern.test(str);
-}
\ No newline at end of file
+}
+
+const UrlUtils = {
+ isUrl
+}
+
+export default UrlUtils
\ No newline at end of file