|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="swiper mySwiper">
|
|
<div class="swiper mySwiper">
|
|
|
<div class="swiper-wrapper">
|
|
<div class="swiper-wrapper">
|
|
|
- <div v-for="item in imgs" class="swiper-slide">
|
|
|
|
|
- <img :src="item" alt="" />
|
|
|
|
|
|
|
+ <div v-for="item in this.$store.state.imgs" class="swiper-slide">
|
|
|
|
|
+ <img :src="item.url" alt="" />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="swiper-button-next"></div>
|
|
<div class="swiper-button-next"></div>
|
|
@@ -11,21 +11,13 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { ref, onMounted, computed } from "vue";
|
|
|
|
|
|
|
+import { ref, onMounted, computed, watch } from "vue";
|
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
|
import exchangeUrl from "utils/exchangeUrl";
|
|
import exchangeUrl from "utils/exchangeUrl";
|
|
|
|
|
+import store from "store/index";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- props: {
|
|
|
|
|
- imgs: {
|
|
|
|
|
- type: Array,
|
|
|
|
|
- default: [
|
|
|
|
|
- // "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/data-platform/ship2.jpg",
|
|
|
|
|
- // "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/data-platform/ship1.jpg",
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- setup() {
|
|
|
|
|
|
|
+ setup(props) {
|
|
|
let swiper = ref({});
|
|
let swiper = ref({});
|
|
|
function init() {
|
|
function init() {
|
|
|
swiper.value = new Swiper(".mySwiper", {
|
|
swiper.value = new Swiper(".mySwiper", {
|
|
@@ -36,12 +28,26 @@ export default {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ watch(
|
|
|
|
|
+ () => store.state.imgs,
|
|
|
|
|
+ (a, b) => {
|
|
|
|
|
+ let t = setTimeout(() => {
|
|
|
|
|
+ update();
|
|
|
|
|
+ }, 50);
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ function update() {
|
|
|
|
|
+ console.log("update");
|
|
|
|
|
+ swiper.value.update();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
init();
|
|
init();
|
|
|
});
|
|
});
|
|
|
return {
|
|
return {
|
|
|
init,
|
|
init,
|
|
|
exchangeUrl,
|
|
exchangeUrl,
|
|
|
|
|
+ update,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|