SignOut.vue 747 B

1234567891011121314151617181920212223242526272829303132
  1. <script setup lang="ts">
  2. import { useDialog } from 'naive-ui'
  3. import { ButtonAnimation } from '@/components'
  4. import { useComponentModifier } from '@/composables'
  5. import { useUserStore } from '@/stores'
  6. const { cleanup } = useUserStore()
  7. const dialog = useDialog()
  8. const { getModalModifier } = useComponentModifier()
  9. const handleSignOutClick = () => {
  10. dialog.info({
  11. ...getModalModifier(),
  12. title: '退出登录',
  13. content: '确定要退出登录吗?',
  14. positiveText: '确定',
  15. negativeText: '取消',
  16. onPositiveClick: () => cleanup(),
  17. })
  18. }
  19. </script>
  20. <template>
  21. <ButtonAnimation
  22. @click="handleSignOutClick"
  23. title="退出登录"
  24. >
  25. <span class="iconify ph--sign-out" />
  26. </ButtonAnimation>
  27. </template>