解决 type DictKey = 空

This commit is contained in:
神仙都没用 2025-02-20 11:01:10 +08:00
parent 669fe3fe30
commit d3d9314abb
4 changed files with 20 additions and 16 deletions

View File

@ -39,7 +39,7 @@
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@cool-vue/vite-plugin": "^8.0.0", "@cool-vue/vite-plugin": "^8.0.1",
"@intlify/unplugin-vue-i18n": "^6.0.3", "@intlify/unplugin-vue-i18n": "^6.0.3",
"@rushstack/eslint-patch": "^1.10.5", "@rushstack/eslint-patch": "^1.10.5",
"@tsconfig/node20": "^20.1.4", "@tsconfig/node20": "^20.1.4",

View File

@ -521,15 +521,16 @@
} }
// 创建 dict // 创建 dict
async function createDict() { async function createDict() {
return axios return axios.get(config.reqUrl + "/" + config.type + "/dict/info/types").then((res) => {
.get(config.reqUrl + "/" + config.type + "/dict/info/types")
.then(async (res) => {
const { code, data } = res.data; const { code, data } = res.data;
if (code === 1000) { if (code === 1000) {
return `type DictKey = ${data.map((e) => `"${e.key}"`).join(" | ")}`; let v = "string";
if (!lodash.isEmpty(data)) {
v = data.map((e) => `"${e.key}"`).join(" | ");
} }
}) return `type DictKey = ${v}`;
.catch((err) => { }); }
});
} }
// 创建 eps // 创建 eps
async function createEps() { async function createEps() {

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-vue/vite-plugin", "name": "@cool-vue/vite-plugin",
"version": "8.0.0", "version": "8.0.1",
"description": "cool-admin、cool-uni builder", "description": "cool-admin、cool-uni builder",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"main": "/dist/index.js", "main": "/dist/index.js",

View File

@ -481,16 +481,19 @@ function createService() {
// 创建 dict // 创建 dict
async function createDict() { async function createDict() {
return axios return axios.get(config.reqUrl + "/" + config.type + "/dict/info/types").then((res) => {
.get(config.reqUrl + "/" + config.type + "/dict/info/types") const { code, data } = res.data as { code: number; data: any[] };
.then(async (res) => {
const { code, data } = res.data;
if (code === 1000) { if (code === 1000) {
return `type DictKey = ${data.map((e: any) => `"${e.key}"`).join(" | ")}`; let v = "string";
if (!isEmpty(data)) {
v = data.map((e) => `"${e.key}"`).join(" | ");
} }
})
.catch((err) => {}); return `type DictKey = ${v}`;
}
});
} }
// 创建 eps // 创建 eps