swiper-background.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="zaiui-swiper-background-box" :class="[show?'show':'',welcome?'welcome':'']">
  3. <block v-for="(item,index) in list_data" :key="index">
  4. <view class="swiper-background" :style="[{backgroundImage:'url('+ item.background +')'}]"
  5. :class="index == indexs?'show':''"></view>
  6. </block>
  7. </view>
  8. </template>
  9. <script>
  10. import _tool from '@/static/zaiui/util/tools.js';
  11. export default {
  12. name: 'swiper-background',
  13. props: {
  14. list_data: {
  15. type: Array,
  16. default: () => {
  17. return []
  18. }
  19. },
  20. indexs: {
  21. type: Number,
  22. default: 0
  23. },
  24. show: {
  25. type: Boolean,
  26. default: false
  27. },
  28. welcome: {
  29. type: Boolean,
  30. default: false
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="scss" scoped>
  36. .zaiui-swiper-background-box {
  37. position: absolute;
  38. height: 348upx;
  39. width: 100%;
  40. top: 0;
  41. display: none;
  42. transition: 0s;
  43. .swiper-background {
  44. position: absolute;
  45. height: 100%;
  46. width: 100%;
  47. opacity: 0;
  48. top: 0;
  49. background-size: cover;
  50. transition: opacity .25s;
  51. }
  52. .swiper-background.show {
  53. opacity: 1;
  54. transition: opacity .25s;
  55. }
  56. }
  57. .zaiui-swiper-background-box.show {
  58. display: block;
  59. transition: 0s;
  60. }
  61. .zaiui-swiper-background-box.welcome {
  62. top: calc(var(--status-bar-height) + 101upx);
  63. transition: top .25s;
  64. }
  65. </style>