uni-app判断是否是app、h5、小程序或者android、ios、小程序
                                                        
                                
                                34144次阅读
                            
                            
                                
                                2613人点赞
                            
                            
                            
                                
                                发布时间: 2022-08-17 10:30:36
                            
                        
                        
                            
                                
                                扫码到手机查看
                                
                                    
                                
                            
                        
                    uni-app判断是否是小程序/app/h5 :
APP:
/*#ifdef APP-PLUS*/
    showClose:true
/*#endif*/
 
H5:
/*#ifdef H5*/
   showClose:true
/*#endif*/
 
MP:
/*#ifdef MP*/
   showClose:true
/*#endif*/uni-app判断是ios、android、小程序 :
let port = uni.getSystemInfoSync().platform
switch (port) {
	case 'android':
		console.log('Android');//android
		break;
	case 'ios':
		console.log('iOS');ios
		break;
	default:
		console.log('小程序');//devtools
		break;
}
                                                            
                
                    
                    
                    
                    
                    
                    
                    
            
            
            
        目录