Browse Source

Update index.tsx

lex 2 năm trước cách đây
mục cha
commit
08b1bddfc8
1 tập tin đã thay đổi với 13 bổ sung2 xóa
  1. 13 2
      src/school/train-planning/modal/timer/index.tsx

+ 13 - 2
src/school/train-planning/modal/timer/index.tsx

@@ -2,7 +2,7 @@ import OHeader from '@/components/o-header'
 import item from '@/student/coupons/item'
 import dayjs from 'dayjs'
 import { Button, Cell, CellGroup, Popup, showToast, Sticky, TimePicker } from 'vant'
-import { defineComponent, onMounted, reactive } from 'vue'
+import { defineComponent, onMounted, reactive, watch } from 'vue'
 import styles from './index.module.less'
 
 export default defineComponent({
@@ -132,7 +132,14 @@ export default defineComponent({
       state.selectTimeStatus = false
     }
 
-    onMounted(() => {
+    watch(
+      () => props.timerList,
+      () => {
+        init()
+      }
+    )
+
+    const init = () => {
       console.log(props.timerList, 'timerList')
       state.calendarDate = props.timerList?.calendarDate
       const timeDetailList = props.timerList?.timeDetailList || []
@@ -160,6 +167,10 @@ export default defineComponent({
         state.minMinute = temp.startMinute
         state.maxMinute = 60
       }
+    }
+
+    onMounted(() => {
+      init()
     })
     return () => (
       <div class={styles.timer}>