index.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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('positive'); //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
  22. class={[
  23. styles.timerTopPane,
  24. activeTab.value == 'positive' ? styles.timerTopPaneActive : ''
  25. ]}
  26. onClick={() => {
  27. setActivePinia('positive');
  28. }}>
  29. 正计时
  30. </div>
  31. <div
  32. class={[
  33. styles.timerTopPane,
  34. activeTab.value == 'countdown' ? styles.timerTopPaneActive : ''
  35. ]}
  36. onClick={() => {
  37. setActivePinia('countdown');
  38. }}>
  39. 倒计时
  40. </div>
  41. </div>
  42. {activeTab.value == 'positive' ? (
  43. <Positive></Positive>
  44. ) : (
  45. <Countdown></Countdown>
  46. )}
  47. </div>
  48. </div>
  49. );
  50. }
  51. });