cover
This commit is contained in:
parent
39e56e8663
commit
f90ee5d5e7
|
@ -3,11 +3,15 @@ import * as d3 from "d3"
|
||||||
import { onMounted } from "vue"
|
import { onMounted } from "vue"
|
||||||
|
|
||||||
import { IMAGE_URL } from '../../constants'
|
import { IMAGE_URL } from '../../constants'
|
||||||
|
import { getRandomIntInclusive } from "../../helpers";
|
||||||
|
|
||||||
const props = defineProps(['files'])
|
const props = defineProps(['files'])
|
||||||
|
const cover = getRandomIntInclusive(0, props.files.length)
|
||||||
|
const coverImg = props.files.length > 1 ? `url(${props.files[cover]})` : 'url(/src/assets/promo/map.png)'
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const files = props.files
|
const files = props.files.length > 1 ? props.files.splice(cover, 1) : props.files
|
||||||
|
|
||||||
// const width = 1920
|
// const width = 1920
|
||||||
// const height = 1080
|
// const height = 1080
|
||||||
const width = window.innerWidth
|
const width = window.innerWidth
|
||||||
|
@ -90,5 +94,12 @@ onMounted(async () => {
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div id="gallery" style=" width: 100vw; height: 100vh;"></div>
|
<div id="gallery"></div>
|
||||||
</template>
|
</template>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
#gallery {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-image: v-bind(coverImg);
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue