From c21b9ee81a97c904de60113a28a985920e8ae95e Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Fri, 7 Jul 2023 04:58:19 +0800 Subject: [PATCH] fix --- AicsKnowledgeBase/qml/page/ContentPage.qml | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index 214f139..1fb3935 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -12,6 +12,7 @@ import "qrc:///AicsKnowledgeBase/qml/component" import "qrc:///AicsKnowledgeBase/qml/global" FluArea { + property ListModel noteListModel2: ListModel {} Popup { id: popup modal: true //模态, 为 true后弹出窗口会叠加一个独特的背景调光效果 @@ -28,7 +29,7 @@ FluArea { backgroundColor: "#f9f9f9" NoteList { id: noteList - //noteListModel: content_page.noteListModel + noteListModel: noteListModel2 onOpen: function handle(noteId, authorId) { emit: SignalFileOperation.openNote(noteId, authorId) popup.close() @@ -79,7 +80,6 @@ FluArea { property string brief: "这是一个简介" property string fileUrl: "https://api.hammer-hfut.tk:233/aics/file/" property string suffix: "md" - property ListModel noteListModel function getType(suffix) { if (suffix === "md") @@ -128,30 +128,32 @@ FluArea { } content_page.favoriteCount = starers.length - noteList.setListModel([]) var notes = data.knowledgeFileAttribute.notes noteCount = notes.length console.log(noteCount) var noteItems = [] + + noteListModel2.clear() for (i = 0; i < notes.length; i++) { var note = notes[i] Request.getSearch( "search/note/" + notes[i].id + "/content", response => { - noteItems.push({ - "uuid": note.id, - "title": note.title, - "brief": response, - "author": note.author.username, - "authorId": note.author.id, - "pageView": note.pageView, - "stars": note.starers.length, - "date": note.createTime - }) + noteListModel2.append({ + "uuid": note.id, + "title": note.title, + "brief": response, + "author": note.author.username, + "authorId": note.author.id, + "pageView": note.pageView, + "stars": note.starers.length, + "date": note.createTime + }) + console.log( + noteListModel2.count) }) } - noteList.noteListModel.append(noteItems) if (content_area.type === "MD") { // console.log(content_area.type) FileTransferManager.getMarkdown(