index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <button size="mini" @click="toCommon('pages/login/index')">登录页面</button>
  6. <button size="mini" @click="toCommon('pages/home/index')">首页</button>
  7. <button size="mini" @click="toCommon('pages/store/index')">微店</button>
  8. <button size="mini" @click="toCommon('pages/week/index')">周边</button>
  9. <button size="mini" @click="toCommon('pages/market/index')">购物车</button>
  10. <button size="mini" @click="toCommon('pages/my/index')">我的1</button>
  11. </view>
  12. </view>
  13. </mobile-frame>
  14. </template>
  15. <script>
  16. export default {
  17. components: {},
  18. data() {
  19. return {};
  20. },
  21. onShow: function() {
  22. const that = this;
  23. // 监听用户是否登录
  24. that.watchLogin();
  25. },
  26. methods: {
  27. // 公共跳转
  28. toCommon(e) {
  29. uni.navigateTo({
  30. url: `/${e}`
  31. });
  32. },
  33. watchLogin() {
  34. uni.redirectTo({
  35. url: `/pages/home/index`
  36. })
  37. },
  38. }
  39. }
  40. </script>
  41. <style lang="scss">
  42. .main {
  43. .one {
  44. text-align: center;
  45. button {
  46. margin: 2vw;
  47. }
  48. }
  49. }
  50. </style>