|
|
@@ -18,21 +18,28 @@
|
|
|
>
|
|
|
<img :src="`data/${$route.params.id}_${item}.png`" alt="" />
|
|
|
</div>
|
|
|
- <!-- <div class="swiper-slide">
|
|
|
- <iframe
|
|
|
- src="http://4dscene.4dage.com/culturalrelics/WZSBWG/Model2.html?m=wzs02"
|
|
|
- frameborder="0"
|
|
|
- ></iframe>
|
|
|
- </div> -->
|
|
|
+ <template v-if="data.url && data.url.length > 0">
|
|
|
+ <div
|
|
|
+ class="swiper-slide"
|
|
|
+ v-for="(url, index) in modelUrl"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <iframe class="iframeBox" :src="url" frameborder="0"></iframe>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 索引 -->
|
|
|
|
|
|
<div class="indexBs">
|
|
|
<div class="swiper-pagination"></div>
|
|
|
<!-- <div>1/{{ data.img + 1 }}</div> -->
|
|
|
</div>
|
|
|
+ <!-- 左右箭头 -->
|
|
|
+ <div class="nextTo">
|
|
|
+ <div class="swiper-button-next">下一件</div>
|
|
|
+ <div class="swiper-button-prev">上一件</div>
|
|
|
+ </div>
|
|
|
<!-- 音乐 -->
|
|
|
<div class="myMusic">
|
|
|
<Audio />
|
|
|
@@ -58,6 +65,7 @@ export default {
|
|
|
return {
|
|
|
data: {},
|
|
|
lookPics: [],
|
|
|
+ modelUrl: [],
|
|
|
};
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
|
@@ -89,14 +97,38 @@ export default {
|
|
|
this.data = info.find((v) => v.id == this.$route.params.id);
|
|
|
this.$nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
- new Swiper(`.model${this.$route.params.id} .swiper-container`, {
|
|
|
- pagination: {
|
|
|
- el: ".swiper-pagination",
|
|
|
- type: "fraction",
|
|
|
- },
|
|
|
- });
|
|
|
+ let aaa = new Swiper(
|
|
|
+ `.model${this.$route.params.id} .swiper-container`,
|
|
|
+ {
|
|
|
+ navigation: {
|
|
|
+ nextEl: ".swiper-button-next",
|
|
|
+ prevEl: ".swiper-button-prev",
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ el: ".swiper-pagination",
|
|
|
+ type: "fraction",
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ slideChange: () => {
|
|
|
+ let ind = aaa.activeIndex;
|
|
|
+ if (this.modelUrl[ind] == "") {
|
|
|
+ let dom = document.querySelectorAll(".iframeBox");
|
|
|
+ dom[ind].src = this.data.url[ind];
|
|
|
+ console.log("-----", dom[ind].src);
|
|
|
+ this.modelUrl[ind] = this.data.url[ind];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+ );
|
|
|
}, 100);
|
|
|
});
|
|
|
+ let temp = [];
|
|
|
+ this.data.url.forEach((v, i) => {
|
|
|
+ if (i === 0) temp.push(v);
|
|
|
+ else temp.push("");
|
|
|
+ });
|
|
|
+ this.modelUrl = temp;
|
|
|
}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
};
|
|
|
</script>
|
|
|
@@ -175,7 +207,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.myMusic {
|
|
|
- padding: 35px 20px 40px 30px;
|
|
|
+ padding: 10px 20px 40px 30px;
|
|
|
border-bottom: 2px dashed rgba(235, 223, 191, 0.2);
|
|
|
}
|
|
|
.txtt {
|
|
|
@@ -187,5 +219,47 @@ export default {
|
|
|
margin-bottom: 30px;
|
|
|
}
|
|
|
}
|
|
|
+ .nextTo {
|
|
|
+ margin-top: 15px;
|
|
|
+ position: relative;
|
|
|
+ width: 100%;
|
|
|
+ height: 50px;
|
|
|
+ z-index: 999;
|
|
|
+ .swiper-button-next {
|
|
|
+ z-index: 999;
|
|
|
+ width: 100px;
|
|
|
+ height: 50px;
|
|
|
+ background-color: #e7dbbc;
|
|
|
+ right: 24px;
|
|
|
+ bottom: 0px;
|
|
|
+ top: auto;
|
|
|
+ background: url("../../assets/img/right.png") right center no-repeat;
|
|
|
+ background-size: 20px 20px;
|
|
|
+ color: #e7dbbc;
|
|
|
+ font-size: 16px;
|
|
|
+
|
|
|
+ &::after {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .swiper-button-prev {
|
|
|
+ padding-left: 36px;
|
|
|
+ width: 110px;
|
|
|
+ z-index: 999;
|
|
|
+ height: 50px;
|
|
|
+ background-color: #e7dbbc;
|
|
|
+ left: 30px;
|
|
|
+ top: auto;
|
|
|
+ background: url("../../assets/img/left.png") left center no-repeat;
|
|
|
+ background-size: 20px 20px;
|
|
|
+ bottom: 0px;
|
|
|
+ color: #e7dbbc;
|
|
|
+ font-size: 16px;
|
|
|
+
|
|
|
+ &::after {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|