From aba4705b8ecc999740e2b0a96c4215e04d1fafc9 Mon Sep 17 00:00:00 2001 From: lizhixian <18210040298@163.com> Date: Tue, 14 Jan 2025 17:17:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=E8=A1=A8=E5=8D=95=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8Cjson=E6=98=BE=E7=A4=BA=E5=92=8C?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/build/index.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/infra/build/index.vue b/src/views/infra/build/index.vue index ed1091e7..2eb63b6a 100644 --- a/src/views/infra/build/index.vue +++ b/src/views/infra/build/index.vue @@ -135,7 +135,8 @@ const makeTemplate = () => { /** 复制 **/ const copy = async (text: string) => { - const { copy, copied, isSupported } = useClipboard({ source: text }) + const textToCopy = JSON.stringify(text, null, 2) + const { copy, copied, isSupported } = useClipboard({ source: textToCopy }) if (!isSupported) { message.error(t('common.copyError')) } else { @@ -149,18 +150,19 @@ const copy = async (text: string) => { /** * 代码高亮 */ -const highlightedCode = (code) => { +const highlightedCode = (code: string) => { // 处理语言和代码 let language = 'json' if (formType.value === 2) { language = 'xml' } + // debugger if (!isString(code)) { - code = JSON.stringify(code) + code = JSON.stringify(code, null, 2) } // 高亮 - const result = hljs.highlight(language, code, true) - return result.value || ' ' + const result = hljs.highlight(code, { language: language, ignoreIllegals: true }) + return result.value } /** 初始化 **/ From 0fa31be851d0fcd30f34d577480ae219761dcaa3 Mon Sep 17 00:00:00 2001 From: lizhixian <18210040298@163.com> Date: Tue, 14 Jan 2025 17:20:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=E8=A1=A8=E5=8D=95=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8Cjson=E6=98=BE=E7=A4=BA=E5=92=8C?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/build/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/infra/build/index.vue b/src/views/infra/build/index.vue index 2eb63b6a..260b8b7a 100644 --- a/src/views/infra/build/index.vue +++ b/src/views/infra/build/index.vue @@ -162,7 +162,7 @@ const highlightedCode = (code: string) => { } // 高亮 const result = hljs.highlight(code, { language: language, ignoreIllegals: true }) - return result.value + return result.value || ' ' } /** 初始化 **/ From 026b2f2ba5bb4957359aa96ffd3ee3fac4ac458b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=8B=E9=81=93=E6=BA=90=E7=A0=81?= Date: Wed, 15 Jan 2025 20:45:49 +0800 Subject: [PATCH 3/3] Revert "fix:Vite CJS Node API deprecated waring" --- .eslintrc.cjs => .eslintrc.js | 0 .vscode/settings.json | 2 +- package.json | 1 - postcss.config.js | 2 +- prettier.config.cjs => prettier.config.js | 0 5 files changed, 2 insertions(+), 3 deletions(-) rename .eslintrc.cjs => .eslintrc.js (100%) rename prettier.config.cjs => prettier.config.js (100%) diff --git a/.eslintrc.cjs b/.eslintrc.js similarity index 100% rename from .eslintrc.cjs rename to .eslintrc.js diff --git a/.vscode/settings.json b/.vscode/settings.json index a14646c9..f145f386 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -138,7 +138,7 @@ "*.ts": "$(capture).test.ts, $(capture).test.tsx", "*.tsx": "$(capture).test.ts, $(capture).test.tsx", "*.env": "$(capture).env.*", - "package.json": "pnpm-lock.yaml,yarn.lock,LICENSE,README*,CHANGELOG*,CNAME,.gitattributes,.eslintrc-auto-import.json,.gitignore,prettier.config.cjs,stylelint.config.js,commitlint.config.js,.stylelintignore,.prettierignore,.gitpod.yml,.eslintrc.cjs,.eslintignore" + "package.json": "pnpm-lock.yaml,yarn.lock,LICENSE,README*,CHANGELOG*,CNAME,.gitattributes,.eslintrc-auto-import.json,.gitignore,prettier.config.js,stylelint.config.js,commitlint.config.js,.stylelintignore,.prettierignore,.gitpod.yml,.eslintrc.js,.eslintignore" }, "terminal.integrated.scrollback": 10000, "nuxt.isNuxtApp": false diff --git a/package.json b/package.json index 95b5345b..ff94abd7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "基于vue3、vite4、element-plus、typesScript", "author": "xingyu", "private": false, - "type": "module", "scripts": { "i": "pnpm install", "dev": "vite --mode env.local", diff --git a/postcss.config.js b/postcss.config.js index e712f561..961986e2 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,4 +1,4 @@ -export default { +module.exports = { plugins: { autoprefixer: {} } diff --git a/prettier.config.cjs b/prettier.config.js similarity index 100% rename from prettier.config.cjs rename to prettier.config.js