You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							32 lines
						
					
					
						
							610 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							32 lines
						
					
					
						
							610 B
						
					
					
				| /* eslint-disable */ | |
| var style = require('../wxs/style.wxs'); | |
| var addUnit = require('../wxs/add-unit.wxs'); | |
| 
 | |
| function rootStyle(data) { | |
|   return style([ | |
|     { | |
|       width: addUnit(data.width), | |
|       height: addUnit(data.height), | |
|       'border-radius': addUnit(data.radius), | |
|     }, | |
|     data.radius ? 'overflow: hidden' : null, | |
|   ]); | |
| } | |
| 
 | |
| var FIT_MODE_MAP = { | |
|   none: 'center', | |
|   fill: 'scaleToFill', | |
|   cover: 'aspectFill', | |
|   contain: 'aspectFit', | |
|   widthFix: 'widthFix', | |
|   heightFix: 'heightFix', | |
| }; | |
| 
 | |
| function mode(fit) { | |
|   return FIT_MODE_MAP[fit]; | |
| } | |
| 
 | |
| module.exports = { | |
|   rootStyle: rootStyle, | |
|   mode: mode, | |
| };
 | |
| 
 |