index.vue 954 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <div class="app-view">
  3. <slot name="header"></slot>
  4. <app-scroll-view :class="['app-view__body', flex && 'flex']">
  5. <slot></slot>
  6. </app-scroll-view>
  7. <slot name="footer"></slot>
  8. </div>
  9. </template>
  10. <script lang="ts" setup>
  11. import { watch } from 'vue'
  12. const props = defineProps({
  13. // 是否为过渡动画状态
  14. animationstart: {
  15. type: Boolean,
  16. default: false
  17. },
  18. // 过渡动画是否已结束,用于防止动画过程中渲染数据导致页面切换卡顿
  19. animationend: {
  20. type: Boolean,
  21. default: true
  22. },
  23. flex: {
  24. type: Boolean,
  25. default: false
  26. }
  27. })
  28. const emit = defineEmits(['update:animationend'])
  29. watch(() => props.animationstart, (status) => {
  30. if (!status) {
  31. emit('update:animationend', true)
  32. }
  33. }, {
  34. immediate: true
  35. })
  36. </script>
  37. <style lang="less" scoped>
  38. @import './index.less';
  39. </style>