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 838d2e88..89477d4c 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 diff --git a/src/views/infra/build/index.vue b/src/views/infra/build/index.vue index ed1091e7..260b8b7a 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,17 +150,18 @@ 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) + const result = hljs.highlight(code, { language: language, ignoreIllegals: true }) return result.value || ' ' }