index.tsx 1.2 KB

1234567891011121314151617181920212223242526272829
  1. import { defineComponent, ref, watch, nextTick, onMounted } from 'vue';
  2. import styles from './index.module.less';
  3. import { NTabs, NTabPane, NSpace, NButton } from 'naive-ui';
  4. import { useRoute } from 'vue-router';
  5. import Countdown from './components/countdown';
  6. import Positive from './components/positive';
  7. export default defineComponent({
  8. name: 'data-module',
  9. setup() {
  10. const activeTab = ref('countdown'); //countdown
  11. const route = useRoute();
  12. // onMounted(() => {
  13. // })
  14. const setActivePinia = (name: string) => {
  15. activeTab.value = name
  16. }
  17. return () => (
  18. <div>
  19. <div class={styles.timerWrap}>
  20. <div class={styles.timerTop}>
  21. <div class={[styles.timerTopPane, activeTab.value == 'positive' ? styles.timerTopPaneActive : '']} onClick={() => { setActivePinia('positive') }}>正计时</div>
  22. <div class={[styles.timerTopPane, activeTab.value == 'countdown' ? styles.timerTopPaneActive : '']} onClick={() => { setActivePinia('countdown') }}>倒计时</div>
  23. </div>
  24. {activeTab.value == 'positive' ? <Positive></Positive> : <Countdown></Countdown>}
  25. </div>
  26. </div>
  27. );
  28. }
  29. });