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

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

View File

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

View File

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