setting.vue 602 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <view class="">
  3. <button type="warn" @click="logout">退出登录</button>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. }
  11. },
  12. onLoad() {},
  13. methods: {
  14. logout() {
  15. uni.showModal({
  16. title: '确认退出',
  17. content: '是否退出当前账号?',
  18. success: (res) => {
  19. if (res.confirm) {
  20. // 清除本地数据
  21. uni.removeStorageSync('accessToken');
  22. uni.removeStorageSync('userInfo');
  23. uni.reLaunch({
  24. url: '/pages/login/index'
  25. });
  26. }
  27. }
  28. });
  29. }
  30. }
  31. }
  32. </script>
  33. <style>
  34. </style>