fix(survey ) : 修复我的问卷搜索功能异常

- 修复点击搜索之后进入其他页面,然后返回会造成数据多次显示的问题
This commit is contained in:
Huangzhe
2025-05-22 11:09:52 +08:00
parent 1ce2499419
commit f05757030c

View File

@@ -26,7 +26,7 @@
</template>
<script setup>
import { onBeforeMount, ref } from 'vue';
import { onBeforeMount, onUnmounted, ref } from 'vue';
import NavSearch from '@/components/Search/Index.vue';
import NewSurvey from '@/views/Home/components/NewSurvey/index.vue';
import EmptyContainer from '@/views/Survey/components/EmptyContainer.vue';
@@ -60,6 +60,11 @@ onBeforeMount(() => {
handleLoadSurveys();
});
onUnmounted(() => {
// 当组件卸载的时候,清空 survey 数据
survey.value = [];
});
function handleLoadSurveys() {
form.value.page = form.value.page + 1;
fetchSurveys(form.value);