index.vue 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div style="" >
  3. <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
  4. height="900px" trigger="click" :autoplay="false" indicator-position="outside">
  5. <el-carousel-item class="lun_img" v-for="(item,index) in imgs" v-bind:key="item" >
  6. <img :src="item" width="100%" height="100%" object-fit="cover" />
  7. </el-carousel-item>
  8. </el-carousel>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. imgs:[],
  16. pptView:false,
  17. }
  18. },
  19. mounted() {
  20. this.ppt()
  21. },
  22. methods: {
  23. ppt(){
  24. this.pptView=true;
  25. console.log(this.$route.query.imgs)
  26. //判断ppt是否可能出现只有一页而页面加载报错的情况 一页就返回string 多页就是返回集合
  27. if(typeof this.$route.query.imgs =='string'){
  28. this.imgs.push( this.$route.query.imgs);
  29. }else {
  30. this.imgs=this.$route.query.imgs
  31. }
  32. console.log(this.imgs)
  33. }
  34. }
  35. }
  36. </script>