解决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",
"version": "5.7.9",
"version": "5.7.10",
"scripts": {
"dev": "vite --host",
"build": "vite build",

View File

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

View File

@ -17,15 +17,17 @@
<cl-pagination />
</el-row>
<cl-upsert ref="Upsert" @opened="onUpsertOpened">
<cl-upsert ref="Upsert">
<template #slot-content="{ scope }">
<div v-for="(item, index) in tab.list" :key="index" class="editor">
<template v-if="tab.index == index">
<el-button class="change-btn" @click="changeTab(item.to)">{{
item.label
}}</el-button>
<div class="editor">
<template v-for="(item, index) in tab.list" :key="index">
<template v-if="tab.index == index">
<el-button class="change-btn" @click="changeTab(item.to)">{{
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>
</div>
</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);
}
//
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>
<style lang="scss" scoped>

View File

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