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)