fix:修改打包选项

This commit is contained in:
lhj
2024-11-16 13:24:16 +08:00
parent ff697b8d42
commit 22cad15cb3
5 changed files with 17 additions and 8 deletions

View File

@ -107,7 +107,7 @@ store.$onAction(
onError, // action 抛出或拒绝的钩子 onError, // action 抛出或拒绝的钩子
}) => { }) => {
after((result) => { after((result) => {
// console.log(`store action-${name}回调后:` + result); // console.log(`store action-${name}回调后:` + JSON.stringify(result));
}); });
onError((error) => { onError((error) => {
console.warn(`Failed "${name}" after\nError: ${error}.`); console.warn(`Failed "${name}" after\nError: ${error}.`);
@ -137,7 +137,7 @@ onMounted(() => {
}); });
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots' | 'visible' | 'disable' | 'children', IComponent>) { function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots' | 'visible' | 'disable' | 'children', IComponent>) {
console.log("clone", element); // console.log("clone", element);
return { return {
id: `${element.type}-${uuid()}`, id: `${element.type}-${uuid()}`,
name: element.name, name: element.name,
@ -157,7 +157,7 @@ function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'tex
} }
const onEnd = (event: DraggableEvent) => { const onEnd = (event: DraggableEvent) => {
// console.log("onEnd", event); console.log("onEnd", event);
store.updateNowScheme(event.clonedData); store.updateNowScheme(event.clonedData);
}; };

View File

@ -138,7 +138,7 @@ const adjustHeaderPosition = () => {
}; };
onMounted(() => { onMounted(() => {
console.log("组件挂载后",props.componentData); // console.log("组件挂载后",props.componentData);
}); });
watch(() => componentSelected.value, () => { watch(() => componentSelected.value, () => {

View File

@ -78,7 +78,7 @@ const scheme = computed<IPageComponent>(() => props.scheme || {} as IPageCompone
// 使用 deep 选项来深度监听对象的变化 // 使用 deep 选项来深度监听对象的变化
watch(scheme, (value, oldValue) => { watch(scheme, (value, oldValue) => {
console.log("scheme Changed", value); // console.log("scheme Changed", value);
if (value) if (value)
store.updateScheme(value.id, value as IComponent); store.updateScheme(value.id, value as IComponent);
}, {deep: true}); }, {deep: true});

View File

@ -15,6 +15,9 @@ function pushToStack(stack: string[], id: string): void {
function popFromStack(stack: string[]): string | undefined { function popFromStack(stack: string[]): string | undefined {
return stack.pop(); return stack.pop();
} }
function topFromStack(stack: string[]): string | undefined {
return stack.at(-1); // 使用 .at() 方法访问最后一个元素
}
function findObjectById(obj: any, targetId: string) { function findObjectById(obj: any, targetId: string) {
if (Array.isArray(obj)) { if (Array.isArray(obj)) {
@ -88,14 +91,20 @@ export const useSchemeStore = defineStore('scheme', {
} }
this.saveNewState(currentStateHash); this.saveNewState(currentStateHash);
}, },
updateNowScheme(updates: Partial<IPageComponent>) { updateNowScheme(updates: Partial<IPageComponent>) {
this.nowComponentsData = updates; this.nowComponentsData = updates;
pushToStack(this.selectedComponentStack, this.nowComponentsData.id); pushToStack(this.selectedComponentStack, this.nowComponentsData.id);
console.log("更新nowComponentsData",this.nowComponentsData);
console.log("更新selectedComponentStack",this.selectedComponentStack);
return this.nowComponentsData;
}, },
deleteScheme(id: string) { deleteScheme(id: string) {
console.log("删除前,组件id",id) console.log("删除前,组件id",id)
console.log("删除前,栈",this.selectedComponentStack) console.log("删除前,栈",this.selectedComponentStack)
const currentStateHash = this.currentHash; const currentStateHash = this.currentHash;
const objToDelete = findObjectById(this.previewScheme, id); const objToDelete = findObjectById(this.previewScheme, id);
if (objToDelete) { if (objToDelete) {
@ -108,7 +117,8 @@ export const useSchemeStore = defineStore('scheme', {
} }
this.saveNewState(currentStateHash); this.saveNewState(currentStateHash);
popFromStack(this.selectedComponentStack); popFromStack(this.selectedComponentStack);
const preComponentId=popFromStack(this.selectedComponentStack) console.log("scheme",this.previewScheme);
const preComponentId=topFromStack(this.selectedComponentStack)
console.log("删除后,栈",this.selectedComponentStack) console.log("删除后,栈",this.selectedComponentStack)
console.log("删除后,前一个组件id",preComponentId) console.log("删除后,前一个组件id",preComponentId)
const preObj=this.getSchemeObj(preComponentId) const preObj=this.getSchemeObj(preComponentId)

View File

@ -10,7 +10,6 @@
/* Bundler mode */ /* Bundler mode */
/* Linting */ /* Linting */
"compilerOptions": { "compilerOptions": {
"sourceMap": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,