fix: フォルダーのページネーションが機能しない (#11187)
* fix: フォルダーのページネーションが機能しない close #11180 * Update MkDrive.vue --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
e40a0b98e4
commit
36d5deeb61
2 changed files with 24 additions and 1 deletions
|
@ -56,7 +56,7 @@
|
|||
/>
|
||||
<!-- SEE: https://stackoverflow.com/questions/18744164/flex-box-align-last-row-to-grid -->
|
||||
<div v-for="(n, i) in 16" :key="i" :class="$style.padding"></div>
|
||||
<MkButton v-if="moreFolders" ref="moreFolders">{{ i18n.ts.loadMore }}</MkButton>
|
||||
<MkButton v-if="moreFolders" ref="moreFolders" @click="fetchMoreFolders">{{ i18n.ts.loadMore }}</MkButton>
|
||||
</div>
|
||||
<div v-show="files.length > 0" ref="filesContainer" :class="$style.files">
|
||||
<XFile
|
||||
|
@ -560,6 +560,28 @@ async function fetch() {
|
|||
fetching.value = false;
|
||||
}
|
||||
|
||||
function fetchMoreFolders() {
|
||||
fetching.value = true;
|
||||
|
||||
const max = 30;
|
||||
|
||||
os.api('drive/folders', {
|
||||
folderId: folder.value ? folder.value.id : null,
|
||||
type: props.type,
|
||||
untilId: folders.value[folders.value.length - 1].id,
|
||||
limit: max + 1,
|
||||
}).then(folders => {
|
||||
if (folders.length === max + 1) {
|
||||
moreFolders.value = true;
|
||||
folders.pop();
|
||||
} else {
|
||||
moreFolders.value = false;
|
||||
}
|
||||
for (const x of folders) appendFolder(x);
|
||||
fetching.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function fetchMoreFiles() {
|
||||
fetching.value = true;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue