clearStorage.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div>
  3. <div class="clear">
  4. <div class="clear_img">
  5. <img src="../../assets/img/chong.png" alt="">
  6. </div>
  7. <div style="width: 100%;text-align: center;">
  8. 清除成功
  9. </div>
  10. <div class="clear_text">
  11. 页面将在{{ nowTime }}秒后返回登录页
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. props: {},
  19. components: {},
  20. data() {
  21. return {
  22. timer: null,
  23. nowTime: 3
  24. };
  25. },
  26. computed: {},
  27. watch: {},
  28. created() {},
  29. mounted() {
  30. clearInterval(this.timer);
  31. this.countdown()
  32. },
  33. methods: {
  34. countdown() {
  35. let that = this;
  36. this.timer = setInterval(() => {
  37. if(that.nowTime != 0) {
  38. that.nowTime = +that.nowTime - 1
  39. } else {
  40. localStorage.clear()
  41. this.$router.push("/login");
  42. }
  43. }, 1000);
  44. }
  45. },
  46. beforeDestroy() {
  47. if (this.timer) {
  48. clearInterval(this.timer);
  49. }
  50. },
  51. };
  52. </script>
  53. <style scoped>
  54. .clear {
  55. width: 100%;
  56. display: flex;
  57. justify-content: center;
  58. font-size: 25px;
  59. margin-top: 100px;
  60. flex-wrap: wrap;
  61. color: #a0a0a0;
  62. }
  63. .clear_img {
  64. width: 100px;
  65. height: 100px;
  66. margin-bottom: 20px;
  67. }
  68. .clear_img img {
  69. width: 100%;
  70. }
  71. .clear_text {
  72. margin-top: 20px;
  73. font-size: 18px;
  74. color: #a0a0a0;
  75. }
  76. </style>