index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div>
  3. <van-tabs :active="active" @change="onChange">
  4. <van-tab title="共享资源" :name="0">
  5. <shareResources ref="shareResources"/>
  6. </van-tab>
  7. <van-tab title="预约历史" :name="1">
  8. <appointmentHistory ref="appointmentHistory"/>
  9. </van-tab>
  10. </van-tabs>
  11. </div>
  12. </template>
  13. <script>
  14. import shareResources from "./components/shareResources.vue";
  15. import appointmentHistory from "./components/appointmentHistory.vue";
  16. export default {
  17. components:{
  18. shareResources,
  19. appointmentHistory
  20. },
  21. name: "index",
  22. data(){
  23. return{
  24. active:0
  25. }
  26. },
  27. onPullDownRefresh() {
  28. this.getList()
  29. },
  30. onShow(){
  31. },
  32. methods:{
  33. getList(){
  34. if(this.active === 0){
  35. this.$refs.shareResources.getList()
  36. setTimeout(function () {
  37. uni.stopPullDownRefresh();
  38. }, 1000);
  39. }
  40. if(this.active === 1){
  41. this.$refs.appointmentHistory.getList()
  42. setTimeout(function () {
  43. uni.stopPullDownRefresh();
  44. }, 1000);
  45. }
  46. },
  47. onChange(e){
  48. this.active = e.detail.name
  49. },
  50. otherFun(object) {
  51. if (object) {
  52. this.getList()
  53. }
  54. },
  55. }
  56. }
  57. </script>
  58. <style scoped>
  59. </style>