File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
ui/src/views/knowledge/component Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,20 @@ const props = defineProps({
7070 knowledgeId: String
7171})
7272
73+ // 初始化加载数据
74+ watchEffect (() => {
75+ if (props .modelValue && props .modelValue .length > 0 ) {
76+ const end = page_size .value * current_page .value ;
77+ localParagraphList .value = props .modelValue .slice (0 , Math .min (end , props .modelValue .length ));
78+ }
79+ })
80+
7381// 监听分页变化,只加载需要的数据
7482watchEffect (() => {
7583 const start = 0 ;
7684 const end = page_size .value * current_page .value ;
77- // 只获取所需数量的数据,而不是每次都对整个数组进行切片
78- if (end <= props .modelValue .length ) {
79- localParagraphList .value = props .modelValue .slice (start , end );
80- }
85+ // 不管数据量多少,都确保获取所有应该显示的数据
86+ localParagraphList .value = props .modelValue .slice (start , Math .min (end , props .modelValue .length ));
8187})
8288
8389const paragraph_list = computed (() => {
You can’t perform that action at this time.
0 commit comments