index.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view class="content">
  3. <doctor-detail v-show="userType==='doctor'"
  4. :seekId="id"
  5. :userType="userType"
  6. :status="status"
  7. :type='type'
  8. ref="doctor-detail"
  9. />
  10. <patient-detail v-show="userType==='patient'"
  11. :seekId="id"
  12. :userType="userType"
  13. :status="status"
  14. ref="patient-detail"
  15. />
  16. </view>
  17. </template>
  18. <script>
  19. import doctorDetail from '../doctorItems/detail/index.vue';
  20. import patientDetail from '../patientItems/detail/index.vue';
  21. export default{
  22. components:{
  23. doctorDetail,patientDetail
  24. },
  25. data(){
  26. return{
  27. userType:"doctor",
  28. status:"",
  29. type:'',
  30. id:""
  31. }
  32. },
  33. onLoad(options) {
  34. this.$nextTick(()=>{
  35. this.init(options);
  36. })
  37. },
  38. methods:{
  39. init(options){
  40. let user=options.user;
  41. this.userType=user;
  42. this.status=options.status;
  43. if(user==='doctor'){
  44. this.type=options.type;
  45. this.$refs['doctor-detail'].init(options)
  46. }else{
  47. this.$refs['patient-detail'].init(options)
  48. }
  49. }
  50. }
  51. }
  52. </script>