<template>
	<view class="content">
		<doctor-detail v-show="userType==='doctor'"
			:seekId="id"
			:userType="userType"
			:status="status"
			:type='type'
			ref="doctor-detail"
		/>	
		<patient-detail v-show="userType==='patient'"
			:seekId="id"
			:userType="userType"
			:status="status"
		    ref="patient-detail"
		 />
	</view>
</template>

<script>
	import doctorDetail from '../doctorItems/detail/index.vue';
	import patientDetail from '../patientItems/detail/index.vue';
	export default{
		components:{
			doctorDetail,patientDetail
		},
		data(){
			return{
				userType:"doctor",
				status:"",
				type:'',
				id:""
			}
		},
		onLoad(options) {
			this.$nextTick(()=>{
				this.init(options);
			})		
		},
		methods:{
			init(options){
				let user=options.user;
				this.userType=user;
				this.status=options.status;
				if(user==='doctor'){
					this.type=options.type;
					this.$refs['doctor-detail'].init(options)
				}else{
					this.$refs['patient-detail'].init(options)
				}				
			}
		}
	}
</script>
