albums: allow 2 columns
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/672/head
parent
e69422b37a
commit
ba326f9552
|
@ -41,6 +41,10 @@ export default defineComponent({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 180,
|
default: 180,
|
||||||
},
|
},
|
||||||
|
minCols: {
|
||||||
|
type: Number,
|
||||||
|
default: 3,
|
||||||
|
},
|
||||||
link: {
|
link: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
|
@ -90,8 +94,9 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
resize() {
|
resize() {
|
||||||
|
// Restrict the number of columns between minCols and the size cap
|
||||||
const w = (<any>this.$refs.recycler).$el.clientWidth;
|
const w = (<any>this.$refs.recycler).$el.clientWidth;
|
||||||
this.gridItems = Math.max(Math.floor(w / this.maxSize), 3);
|
this.gridItems = Math.max(Math.floor(w / this.maxSize), this.minCols);
|
||||||
this.itemSize = Math.floor(w / this.gridItems);
|
this.itemSize = Math.floor(w / this.gridItems);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<EmptyContent v-if="!items.length && !loading" />
|
<EmptyContent v-if="!items.length && !loading" />
|
||||||
|
|
||||||
<ClusterGrid :items="items" />
|
<ClusterGrid :items="items" :minCols="minCols" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Timeline v-else />
|
<Timeline v-else />
|
||||||
|
@ -48,6 +48,10 @@ export default defineComponent({
|
||||||
noParams() {
|
noParams() {
|
||||||
return !this.$route.params.name && !this.$route.params.user;
|
return !this.$route.params.name && !this.$route.params.user;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
minCols() {
|
||||||
|
return this.$route.name === 'albums' ? 2 : 3;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
Loading…
Reference in New Issue