Update carousel-list.vue
This commit is contained in:
1 parent
2f5ccc6263
commit
bcff918b60
1 file changed
+26
-8
@@ -1,13 +1,16 @@
|
||||
<template>
|
||||
{{ intervalcomp }}
|
||||
<v-carousel
|
||||
|
||||
interval="10000"
|
||||
v-model="currentslide"
|
||||
:interval="intervalcomp"
|
||||
cover
|
||||
|
||||
height="450"
|
||||
hide-delimiters
|
||||
hide-delimiter-background
|
||||
:show-arrows="carous.length<2?false:'hover'"
|
||||
color="white"
|
||||
@update:modelValue="intervalcomp=10000"
|
||||
>
|
||||
|
||||
<template v-for="(x, i) in carous" :key="i">
|
||||
@@ -70,23 +73,27 @@
|
||||
<v-carousel-item v-else >
|
||||
|
||||
<div class="d-flex justify-center">
|
||||
<video
|
||||
style="height: 450px;"
|
||||
<video
|
||||
ref="videoElement"
|
||||
style="height: 450px;width: 100%;"
|
||||
controls
|
||||
autoplay
|
||||
preload="metadata"
|
||||
@loadedmetadata="intervalcomp = videoElement[currentslide].duration"
|
||||
>
|
||||
<source :src="`${burl}${x.link}`" type="video/mp4" />
|
||||
|
||||
Текущий браузер не поддерживает воспроизведение этого видео.
|
||||
</video>
|
||||
</div>
|
||||
|
||||
|
||||
</v-carousel-item>
|
||||
</template>
|
||||
</v-carousel>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { useAlertStore } from "@/store/useAlertStore";
|
||||
@@ -94,9 +101,9 @@ import { useAlertStore } from "@/store/useAlertStore";
|
||||
export default {
|
||||
|
||||
setup() {
|
||||
|
||||
const currentslide=ref(0)
|
||||
const burl = baseURL.slice(0, -1);
|
||||
|
||||
const videoElement=ref(null)
|
||||
const carous = ref([{ link: `/media/newsimage/scales.jpg`, "title": null, "text": "" }]);
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
@@ -118,8 +125,19 @@ export default {
|
||||
};
|
||||
|
||||
getfromserver();
|
||||
const interval=ref(10000)
|
||||
const intervalcomp = computed({get(){
|
||||
return interval.value},
|
||||
set(val){
|
||||
interval.value=val
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
videoElement,
|
||||
currentslide,
|
||||
interval,
|
||||
intervalcomp,
|
||||
burl,
|
||||
carous,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user