浏览代码

Update index.tsx

lex 2 年之前
父节点
当前提交
08b1bddfc8
共有 1 个文件被更改,包括 13 次插入2 次删除
  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 item from '@/student/coupons/item'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import { Button, Cell, CellGroup, Popup, showToast, Sticky, TimePicker } from 'vant'
 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'
 import styles from './index.module.less'
 
 
 export default defineComponent({
 export default defineComponent({
@@ -132,7 +132,14 @@ export default defineComponent({
       state.selectTimeStatus = false
       state.selectTimeStatus = false
     }
     }
 
 
-    onMounted(() => {
+    watch(
+      () => props.timerList,
+      () => {
+        init()
+      }
+    )
+
+    const init = () => {
       console.log(props.timerList, 'timerList')
       console.log(props.timerList, 'timerList')
       state.calendarDate = props.timerList?.calendarDate
       state.calendarDate = props.timerList?.calendarDate
       const timeDetailList = props.timerList?.timeDetailList || []
       const timeDetailList = props.timerList?.timeDetailList || []
@@ -160,6 +167,10 @@ export default defineComponent({
         state.minMinute = temp.startMinute
         state.minMinute = temp.startMinute
         state.maxMinute = 60
         state.maxMinute = 60
       }
       }
+    }
+
+    onMounted(() => {
+      init()
     })
     })
     return () => (
     return () => (
       <div class={styles.timer}>
       <div class={styles.timer}>