index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <h1>{{ msg }}</h1>
  3. <a-button @click="test">change </a-button>
  4. <div class="sw">
  5. <Scrollbar ref="a">
  6. <div class="ss">13123</div>
  7. </Scrollbar>
  8. </div>
  9. <a-button @click="test1" type="primary">change</a-button>
  10. <ScrollYTransition>
  11. <div class="box" v-show="show"> 1 </div>
  12. </ScrollYTransition>
  13. <!-- <BasicModal /> -->
  14. </template>
  15. <script lang="ts">
  16. import { defineComponent, ref } from 'vue';
  17. import { Scrollbar } from '/@/components/Scrollbar/index';
  18. import { ScrollContainer } from '/@/components/Container/index';
  19. import { defHttp } from '/@/utils/http/axios';
  20. import { useThemeMode } from '/@/useApp';
  21. import { useMessage } from '/@/hooks/web/useMessage';
  22. import {
  23. CollapseTransition,
  24. ExpandXTransition,
  25. ScaleTransition,
  26. ScaleRotateTransition,
  27. ScrollYTransition,
  28. } from '/@/components/Transition';
  29. import { ThemeModeEnum } from '../enums/appEnum';
  30. // import { BasicModal } from '/@/components/modal';
  31. export default defineComponent({
  32. name: 'Home',
  33. components: {
  34. Scrollbar,
  35. CollapseTransition,
  36. ExpandXTransition,
  37. ScaleTransition,
  38. ScaleRotateTransition,
  39. ScrollYTransition,
  40. ScrollContainer,
  41. // BasicModal
  42. },
  43. setup() {
  44. const { createMessage } = useMessage();
  45. createMessage.success({
  46. content: '123',
  47. duration: 999999,
  48. });
  49. // createMessage.error('123');
  50. // createMessage.info('123');
  51. // createMessage.warning('123');
  52. // createConfirm({
  53. // iconType: 'success',
  54. // title: '123',
  55. // content: '123',
  56. // });
  57. const { runChangeThemeMode } = useThemeMode(ThemeModeEnum.DARK);
  58. let msg = ref('hello Home');
  59. const show = ref(true);
  60. function test() {
  61. msg.value = 'hello Home1';
  62. }
  63. defHttp.request({
  64. method: 'post',
  65. url: '/login',
  66. params: {
  67. username: 'vben',
  68. password: '123456',
  69. },
  70. });
  71. const a = ref(null);
  72. function test1() {
  73. runChangeThemeMode();
  74. // show.value = !show.value;
  75. // a.value.scrollTo(200);
  76. }
  77. return {
  78. a,
  79. msg,
  80. test,
  81. show,
  82. test1,
  83. };
  84. },
  85. });
  86. </script>
  87. <style lang="less" scoped>
  88. .sw {
  89. width: 300px;
  90. height: 300px;
  91. border: 1px solid red;
  92. .scrollbar {
  93. height: 100%;
  94. }
  95. .ss {
  96. height: 500px;
  97. }
  98. }
  99. .box {
  100. width: 200px;
  101. height: 200px;
  102. background: #000;
  103. }
  104. </style>