index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="container">
  3. <view class="intro">本项目已包含uni ui组件,无需import和注册,可直接使用。在代码区键入字母u,即可通过代码助手列出所有可用组件。光标置于组件名称处按F1,即可查看组件文档。</view>
  4. <text class="intro">详见:</text>
  5. <uni-link :href="href" :text="href"></uni-link>
  6. <!-- <mescroll-body ref="mescrollRef" @init="mescrollInit" @up="upCallback" @down="downCallback">
  7. <view class="content3" v-for="(item,index) in infoList">
  8. </view>
  9. </mescroll-body> -->
  10. <u-toast ref="uToast"></u-toast>
  11. </view>
  12. </template>
  13. <script>
  14. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  15. import {
  16. mapState,
  17. mapMutations
  18. } from 'vuex';
  19. export default {
  20. mixins: [MescrollMixin], // 使用mixin
  21. computed: {
  22. ...mapState(['hasLogin'])
  23. },
  24. data() {
  25. return {
  26. href: 'https://uniapp.dcloud.io/component/README?id=uniui',
  27. canReset: false,
  28. userInfo: {},
  29. infoList: []
  30. }
  31. },
  32. onShow() {
  33. // 时间戳格式化
  34. // parseTime(item.gmtCreate)
  35. // this.$refs.uToast.show({
  36. // type: 'success',
  37. // message: '提交成功!',
  38. // })
  39. // this.$nextTick(function() {
  40. // this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  41. // this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  42. // this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  43. // });
  44. // if (this.hasLogin || uni.getStorageSync("userInfo").username) {
  45. // this.userInfo = uni.getStorageSync("userInfo")
  46. // this.isLogin = true
  47. // } else {
  48. // uni.navigateTo({
  49. // url: "/pages/login/login"
  50. // })
  51. // }
  52. },
  53. methods: {
  54. // upCallback(page) {
  55. // uni.showLoading({
  56. // title: '数据加载中'
  57. // })
  58. // this.$request.baseRequest('pincheCarSharingApp', 'list', {
  59. // remark2: this.route,
  60. // carpoolingType: this.type,
  61. // companyId: 1,
  62. // pageNum: page.num,
  63. // pageSize: page.size,
  64. // }, failres => {
  65. // console.log('res+++++', failres.errmsg)
  66. // this.$refs.uToast.show({
  67. // type: 'error',
  68. // message: failres.errmsg,
  69. // })
  70. // uni.hideLoading()
  71. // }).then(res => {
  72. // // if (res.errno == 200) {
  73. // uni.hideLoading()
  74. // console.log(11)
  75. // let curPageData = res.data.items;
  76. // let totalPage = res.data.total;
  77. // let curPageLen = curPageData.length;
  78. // this.mescroll.endByPage(curPageLen, totalPage);
  79. // console.log(res.data)
  80. // // this.makeData(res.data)
  81. // if (page.num == 1) this.infoList = []; //如果是第一页需手动置空列表
  82. // this.infoList = this.infoList.concat(curPageData); //追加新数据
  83. // // }
  84. // })
  85. // },
  86. }
  87. }
  88. </script>
  89. <style>
  90. .container {
  91. padding: 20px;
  92. font-size: 14px;
  93. line-height: 24px;
  94. }
  95. </style>