index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 class="two">
  13. </view>
  14. </view>
  15. </mobile-frame>
  16. </template>
  17. <script>
  18. export default {
  19. components: {},
  20. data() {
  21. return {
  22. };
  23. },
  24. onLoad: function() {},
  25. onShow: function() {
  26. const that = this;
  27. // 监听用户是否登录
  28. that.watchLogin();
  29. },
  30. methods: {
  31. // 公共跳转
  32. toCommon(e) {
  33. uni.navigateTo({
  34. url: `/${e}`
  35. });
  36. },
  37. watchLogin() {
  38. // const key = '5WLBZ-H6RWU-NQVVO-BQG7I-XEHFK-PAFSF'; //使用在腾讯位置服务申请的key
  39. // const referer = 'test'; //调用插件的app的名称
  40. // const location = JSON.stringify({
  41. // latitude: 39.89631551,
  42. // longitude: 116.323459711
  43. // });
  44. // const category = '';
  45. // console.log('1');
  46. // uni.navigateTo({
  47. // url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category
  48. // });
  49. uni.redirectTo({
  50. url: `/pages/home/index`
  51. })
  52. },
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .main {
  58. .one {
  59. text-align: center;
  60. button {
  61. margin: 2vw;
  62. }
  63. }
  64. }
  65. </style>