fix: 修复跳转刷新问题

This commit is contained in:
橙子
2025-02-04 15:47:59 +08:00
parent f203c53e19
commit e69bbb46b3
2 changed files with 124 additions and 113 deletions

View File

@@ -9,14 +9,16 @@
<el-button <el-button
style="width: 100%; margin-bottom: 0.8rem" style="width: 100%; margin-bottom: 0.8rem"
@click="loadDiscuss(true)" @click="loadDiscuss(true)"
>主题首页</el-button >主题首页
</el-button
> >
<el-button <el-button
v-if="isAddArticle && isArticleUser" v-if="isAddArticle && isArticleUser"
@click="addArticle('00000000-0000-0000-0000-000000000000')" @click="addArticle('00000000-0000-0000-0000-000000000000')"
type="primary" type="primary"
style="width: 100%; margin-bottom: 0.8rem; margin-left: 0" style="width: 100%; margin-bottom: 0.8rem; margin-left: 0"
>添加子文章</el-button >添加子文章
</el-button
> >
<!--目录在这里 --> <!--目录在这里 -->
<el-scrollbar style="min-height: 410px"> <el-scrollbar style="min-height: 410px">
@@ -111,14 +113,16 @@
size="default" size="default"
v-if="isEditTheme && isArticleUser" v-if="isEditTheme && isArticleUser"
@click="updateHander(route.params.discussId)" @click="updateHander(route.params.discussId)"
>编辑</el-button >编辑
</el-button
> >
<el-button <el-button
style="margin-left: 1rem" style="margin-left: 1rem"
type="danger" type="danger"
v-if="isRemoveTheme && isArticleUser" v-if="isRemoveTheme && isArticleUser"
@click="delHander(route.params.discussId)" @click="delHander(route.params.discussId)"
>删除</el-button >删除
</el-button
> >
</li> </li>
<li>分类: <span>主题</span></li> <li>分类: <span>主题</span></li>
@@ -146,7 +150,8 @@
style="width: 100%; justify-content: left" style="width: 100%; justify-content: left"
type="primary" type="primary"
text text
>{{ `${i + 1} ${item}` }}</el-button >{{ `${i + 1} ${item}` }}
</el-button
> >
</li> </li>
</ul> </ul>
@@ -391,7 +396,14 @@ onMounted(async () => {
await loadAuthorData(); await loadAuthorData();
await loadThemeData(); await loadThemeData();
}); });
//路由发送变化,重新加载
watch(() => route.params, async () => {
await loadDiscuss();
await loadArticleData();
await loadAuthorData();
await loadThemeData();
}
)
watch( watch(
() => currentArticle.value, () => currentArticle.value,
@@ -418,8 +430,7 @@ watch(
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.subtitle .subtitle {
{
color: #999AAA; color: #999AAA;
margin: 0; margin: 0;
} }
@@ -427,6 +438,7 @@ watch(
.article-box { .article-box {
width: 1500px; width: 1500px;
height: 100%; height: 100%;
.comment { .comment {
min-height: 40rem; min-height: 40rem;
} }

View File

@@ -57,7 +57,6 @@ const seeNumLength = ref(props.themeData.seeNum.toString().length);
const handleClickTheme = (id) => { const handleClickTheme = (id) => {
router.push(`/article/${id}`); router.push(`/article/${id}`);
router.go(0);
}; };
</script> </script>