caozhaorui hace 1 año
padre
commit
c939ad0010
Se han modificado 3 ficheros con 16 adiciones y 17 borrados
  1. 0 1
      src/views/auto/index.vue
  2. 8 8
      src/views/pc/index.vue
  3. 8 8
      src/views/screen/index.vue

+ 0 - 1
src/views/auto/index.vue

@@ -29,7 +29,6 @@ export default defineComponent({
       comIs: PcCom
     });
     onMounted(() => {
-      console.log(document.body.clientWidth)
       if (document.body.clientWidth <= 2000) {
         state.comIs = PcCom
       } else {

+ 8 - 8
src/views/pc/index.vue

@@ -110,16 +110,16 @@ export default defineComponent({
         const len = BgImgMapper.length - 1
         if (state.bgImgIndex === len) {
           state.bgImgIndex = 0
-          ref_pcBg.value.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
-          ref_pcBg.value.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
-          ref_pcBg.value.children[Math.abs(len - len)].classList.add('animate__fadeOut')
-          ref_pcBg.value.children[Math.abs(len - len)].classList.remove('animate__fadeIn')
+          ref_pcBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
+          ref_pcBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
+          ref_pcBg.value?.children[Math.abs(len - len)].classList.add('animate__fadeOut')
+          ref_pcBg.value?.children[Math.abs(len - len)].classList.remove('animate__fadeIn')
         } else {
           state.bgImgIndex++
-          ref_pcBg.value.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
-          ref_pcBg.value.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
-          ref_pcBg.value.children[Math.abs(state.bgImgIndex - 1 - len)].classList.add('animate__fadeOut')
-          ref_pcBg.value.children[Math.abs(state.bgImgIndex - 1 - len)].classList.remove('animate__fadeIn')
+          ref_pcBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
+          ref_pcBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
+          ref_pcBg.value?.children[Math.abs(state.bgImgIndex - 1 - len)].classList.add('animate__fadeOut')
+          ref_pcBg.value?.children[Math.abs(state.bgImgIndex - 1 - len)].classList.remove('animate__fadeIn')
         }
       }, 5000)
     })

+ 8 - 8
src/views/screen/index.vue

@@ -143,16 +143,16 @@ export default defineComponent({
         const len = BgImgMapper.length - 1
         if (state.bgImgIndex === len) {
           state.bgImgIndex = 0
-          ref_screenBg.value.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
-          ref_screenBg.value.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
-          ref_screenBg.value.children[Math.abs(len - len)].classList.add('animate__fadeOut')
-          ref_screenBg.value.children[Math.abs(len - len)].classList.remove('animate__fadeIn')
+          ref_screenBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
+          ref_screenBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
+          ref_screenBg.value?.children[Math.abs(len - len)].classList.add('animate__fadeOut')
+          ref_screenBg.value?.children[Math.abs(len - len)].classList.remove('animate__fadeIn')
         } else {
           state.bgImgIndex++
-          ref_screenBg.value.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
-          ref_screenBg.value.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
-          ref_screenBg.value.children[Math.abs(state.bgImgIndex - 1 - len)].classList.add('animate__fadeOut')
-          ref_screenBg.value.children[Math.abs(state.bgImgIndex - 1 - len)].classList.remove('animate__fadeIn')
+          ref_screenBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.add('animate__fadeIn')
+          ref_screenBg.value?.children[Math.abs(state.bgImgIndex - len)].classList.remove('animate__fadeOut')
+          ref_screenBg.value?.children[Math.abs(state.bgImgIndex - 1 - len)].classList.add('animate__fadeOut')
+          ref_screenBg.value?.children[Math.abs(state.bgImgIndex - 1 - len)].classList.remove('animate__fadeIn')
         }
       }, 5000)
     })