解决opened失效问题

This commit is contained in:
icssoa 2022-08-10 18:03:46 +08:00
parent 62020ec8a5
commit 4a52b02715
4 changed files with 29 additions and 31 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "front-next", "name": "front-next",
"version": "5.7.9", "version": "5.7.10",
"scripts": { "scripts": {
"dev": "vite --host", "dev": "vite --host",
"build": "vite build", "build": "vite build",

View File

@ -124,8 +124,6 @@ request.interceptors.response.use(
const { status, config } = error.response; const { status, config } = error.response;
const { user } = useBase(); const { user } = useBase();
console.log(config);
if (status == 401) { if (status == 401) {
user.logout(); user.logout();
} }

View File

@ -17,15 +17,17 @@
<cl-pagination /> <cl-pagination />
</el-row> </el-row>
<cl-upsert ref="Upsert" @opened="onUpsertOpened"> <cl-upsert ref="Upsert">
<template #slot-content="{ scope }"> <template #slot-content="{ scope }">
<div v-for="(item, index) in tab.list" :key="index" class="editor"> <div class="editor">
<template v-if="tab.index == index"> <template v-for="(item, index) in tab.list" :key="index">
<el-button class="change-btn" @click="changeTab(item.to)">{{ <template v-if="tab.index == index">
item.label <el-button class="change-btn" @click="changeTab(item.to)">{{
}}</el-button> item.label
}}</el-button>
<component :is="item.component" v-model="scope.data" height="300px" /> <component :is="item.component" v-model="scope.data" height="300px" />
</template>
</template> </template>
</div> </div>
</template> </template>
@ -150,7 +152,19 @@ const Upsert = useUpsert({
} }
} }
} }
] ],
onOpened(isEdit, data) {
tab.index = null;
nextTick(() => {
if (isEdit) {
tab.index = /<*>/g.test(data.data) ? 1 : 0;
} else {
tab.index = 1;
}
});
}
}); });
// //
@ -164,19 +178,6 @@ function changeTab(i: number) {
}) })
.catch(() => null); .catch(() => null);
} }
//
function onUpsertOpened(isEdit: boolean, data: any) {
tab.index = null;
nextTick(() => {
if (isEdit) {
tab.index = /<*>/g.test(data.data) ? 1 : 0;
} else {
tab.index = 1;
}
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -23,7 +23,7 @@
<cl-pagination /> <cl-pagination />
</el-row> </el-row>
<cl-upsert ref="Upsert" @opened="onUpsertOpened"> <cl-upsert ref="Upsert">
<template #slot-relevance="{ scope }"> <template #slot-relevance="{ scope }">
<el-switch <el-switch
v-model="scope.relevance" v-model="scope.relevance"
@ -113,7 +113,11 @@ const Upsert = useUpsert({
name: "slot-relevance" name: "slot-relevance"
} }
} }
] ],
onOpened(_, data) {
onRelevanceChange(data.relevance || 0);
}
}); });
// cl-table // cl-table
@ -164,9 +168,4 @@ function onRelevanceChange(val: number) {
checkStrictly: val == 0 checkStrictly: val == 0
}); });
} }
//
function onUpsertOpened(_: boolean, data: Eps.BaseSysRoleEntity) {
onRelevanceChange(data.relevance || 0);
}
</script> </script>