fix: no items displayed on file listing

pull/1373/head
Ramires Viana 2021-04-14 11:51:33 +00:00
parent 73ccbe912f
commit 18889ad725
1 changed files with 13 additions and 2 deletions

View File

@ -254,6 +254,7 @@
</template> </template>
<script> <script>
import Vue from "vue";
import { mapState, mapGetters, mapMutations } from "vuex"; import { mapState, mapGetters, mapMutations } from "vuex";
import { users, files as api } from "@/api"; import { users, files as api } from "@/api";
import { enableExec } from "@/utils/constants"; import { enableExec } from "@/utils/constants";
@ -279,6 +280,7 @@ export default {
showLimit: 50, showLimit: 50,
dragCounter: 0, dragCounter: 0,
width: window.innerWidth, width: window.innerWidth,
itemWeight: 0,
}; };
}, },
computed: { computed: {
@ -362,8 +364,14 @@ export default {
// Reset the show value // Reset the show value
this.showLimit = 50; this.showLimit = 50;
// Ensures that the listing is displayed
Vue.nextTick(() => {
// How much every listing item affects the window height
this.setItemWeight();
// Fill and fit the window with listing items // Fill and fit the window with listing items
this.fillWindow(true); this.fillWindow(true);
});
}, },
}, },
mounted: function () { mounted: function () {
@ -813,6 +821,9 @@ export default {
} }
}, },
setItemWeight() { setItemWeight() {
// Listing element is not displayed
if (this.$refs.listing == null) return;
let itemQuantity = this.req.numDirs + this.req.numFiles; let itemQuantity = this.req.numDirs + this.req.numFiles;
if (itemQuantity > this.showLimit) itemQuantity = this.showLimit; if (itemQuantity > this.showLimit) itemQuantity = this.showLimit;