lex преди 2 години
родител
ревизия
ca90dc0641
променени са 3 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 1 1
      src/views/unit-test/examination-mode/index.tsx
  2. 1 1
      src/views/unit-test/practice-mode/index.tsx
  3. 1 1
      src/views/unit-test/unit-detail/index.tsx

+ 1 - 1
src/views/unit-test/examination-mode/index.tsx

@@ -121,7 +121,7 @@ export default defineComponent({
           //   document.querySelectorAll('.swipe-item-question')[state.currentIndex]
           const currentItemDom: any = document
             .querySelectorAll('.van-swipe-item')
-            [state.currentIndex].querySelector('.swipe-item-question')
+            [state.currentIndex]?.querySelector('.swipe-item-question')
           const rect = useRect(currentItemDom)
 
           state.swipeHeight = rect.height

+ 1 - 1
src/views/unit-test/practice-mode/index.tsx

@@ -196,7 +196,7 @@ export default defineComponent({
           // console.log(document.querySelectorAll('.van-swipe-item'), state.currentIndex)
           const currentItemDom: any = document
             .querySelectorAll('.van-swipe-item')
-            [state.currentIndex].querySelector('.swipe-item-question')
+            [state.currentIndex]?.querySelector('.swipe-item-question')
           const rect = useRect(currentItemDom)
           state.swipeHeight = rect.height
         }, 100)

+ 1 - 1
src/views/unit-test/unit-detail/index.tsx

@@ -158,7 +158,7 @@ export default defineComponent({
         setTimeout(() => {
           const currentItemDom: any = document
             .querySelectorAll('.van-swipe-item')
-            [state.currentIndex].querySelector('.swipe-item-question')
+            [state.currentIndex]?.querySelector('.swipe-item-question')
           const rect = useRect(currentItemDom)
           console.log('🚀 ~ setTimeout ~ currentItemDom', currentItemDom)
           console.log('🚀 ~ setTimeout ~ rect', rect, state.currentIndex)