index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="index-box">
  3. <index-nav @setTabNum="setTabNum"></index-nav>
  4. <view class="list-box">
  5. <view class="box-one" v-if="tabNum===0">
  6. <slide-item></slide-item>
  7. </view>
  8. <view class="box-two" v-else-if="tabNum===1">
  9. <attachment-list></attachment-list>
  10. </view>
  11. <view class="box-three" v-else>
  12. <attachment-list></attachment-list>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import IndexNav from "@/pages/index/model/index-nav";
  19. import AttachmentList from "@/pages/index/model/attachment-list";
  20. import SlideItem from "@/pages/index/model/slide-item";
  21. import inobounce from 'inobounce'
  22. export default {
  23. components: {SlideItem, AttachmentList, IndexNav},
  24. data() {
  25. return {
  26. tabNum:0
  27. }
  28. },
  29. created() {
  30. let u = navigator.userAgent
  31. if (u.indexOf('iPhone') > -1) {
  32. inobounce.enable()
  33. }
  34. },
  35. beforeDestroy() {
  36. inobounce.disable()
  37. },
  38. methods: {
  39. setTabNum(tabNum){
  40. this.tabNum=tabNum
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped lang="scss">
  46. .index-box{
  47. overflow: hidden;
  48. -webkit-overflow-scrolling: touch;
  49. overscroll-behavior: none;
  50. height: calc(100vh - 50px - env(safe-area-inset-bottom));
  51. width: 100vw;
  52. .box-one{
  53. }
  54. }
  55. </style>