index.vue 877 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="content">
  3. </view>
  4. </template>
  5. <script>
  6. import {
  7. ref
  8. } from 'vue';
  9. export default {
  10. data() {
  11. const token = ref(null)
  12. const user = ref(null)
  13. return {
  14. token,
  15. user,
  16. }
  17. },
  18. onLoad() {
  19. },
  20. onShow() {
  21. this.token = uni.getStorageSync('token');
  22. this.user = uni.getStorageSync('user');
  23. },
  24. methods: {
  25. avatarClick() {
  26. if (this.token) {
  27. } else {
  28. uni.navigateTo({
  29. url: "/pages/login/index"
  30. })
  31. }
  32. },
  33. logout() {
  34. uni.removeStorageSync('token')
  35. uni.removeStorageSync('user')
  36. this.token = uni.getStorageSync('token');
  37. this.user = uni.getStorageSync('user');
  38. },
  39. dialogToggle() {
  40. this.$refs.alertDialog.open()
  41. },
  42. }
  43. }
  44. </script>
  45. <style>
  46. .content {
  47. display: flex;
  48. flex-direction: column;
  49. align-items: center;
  50. justify-content: center;
  51. }
  52. </style>