修复 动态组件路径问题
This commit is contained in:
parent
d90c357cad
commit
141a8891ec
|
|
@ -29,7 +29,7 @@ import { hTableAPI } from "@/api/hTable";
|
|||
import { getenum } from "@/api/enum";
|
||||
//按钮权限
|
||||
import { hasPerms } from "@/utils/auth";
|
||||
|
||||
const modules = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
||||
const props = defineProps({
|
||||
//** 传入的表单数据 */
|
||||
Row: {
|
||||
|
|
@ -200,13 +200,13 @@ async function handleCustom(obj, row, custom: ButtonCustomConfig) {
|
|||
dialog.value.custom.data = row || [];
|
||||
dialog.value.custom.custom = custom || [];
|
||||
// 异步加载组件
|
||||
dialog.value.custom.component = defineAsyncComponent({
|
||||
loader: () => import(/* @vite-ignore */ `../../views/${custom.src}.vue`),
|
||||
});
|
||||
// let r = shallowRef(null);
|
||||
// const module = await import(custom.src);
|
||||
// r.value = module.default;
|
||||
// dialog.value.custom.component = r;
|
||||
// dialog.value.custom.component = defineAsyncComponent({
|
||||
// loader: () => import(/* @vite-ignore */ `../../views/${custom.src}.vue`),
|
||||
// });
|
||||
let r = shallowRef(null);
|
||||
const module: any = await modules[`/src/views/${custom.src}.vue`](); //import(`@/views/${custom.src}.vue`);
|
||||
r.value = module.default;
|
||||
dialog.value.custom.component = r;
|
||||
|
||||
dialog.value.width = custom.width;
|
||||
dialog.value.title = custom.title;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ export function entryExamInfo(eid: number) {
|
|||
if (res.code !== 200) return ElMessage.error(res.message);
|
||||
else return ElMessage.success("所有数据录入成功");
|
||||
} else if (res.type === "application/json") {
|
||||
let json = await res.text();
|
||||
if (json !== undefined && json.Code !== 200) {
|
||||
return ElMessage.error(json.Message);
|
||||
let json = JSON.parse(await res.text());
|
||||
if (json !== undefined && json.code !== 200) {
|
||||
return ElMessage.error(json.message);
|
||||
} else {
|
||||
return ElMessage.success("操所有数据录入成功作成功");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue