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.
		
		
		
		
			
				
					44 lines
				
				830 B
			
		
		
			
		
	
	
					44 lines
				
				830 B
			| 
											6 months ago
										 | /* eslint-disable */ | ||
|  | var style = require('../wxs/style.wxs'); | ||
|  | var addUnit = require('../wxs/add-unit.wxs'); | ||
|  | 
 | ||
|  | function isImage(name) { | ||
|  |   return name.indexOf('/') !== -1; | ||
|  | } | ||
|  | 
 | ||
|  | function rootClass(data) { | ||
|  |   var classes = ['custom-class']; | ||
|  | 
 | ||
|  |   if (data.classPrefix !== 'van-icon') { | ||
|  |     classes.push('van-icon--custom') | ||
|  |   } | ||
|  | 
 | ||
|  |   if (data.classPrefix != null) { | ||
|  |     classes.push(data.classPrefix); | ||
|  |   } | ||
|  | 
 | ||
|  |   if (isImage(data.name)) { | ||
|  |     classes.push('van-icon--image'); | ||
|  |   } else if (data.classPrefix != null) { | ||
|  |     classes.push(data.classPrefix + '-' + data.name); | ||
|  |   } | ||
|  | 
 | ||
|  |   return classes.join(' '); | ||
|  | } | ||
|  | 
 | ||
|  | function rootStyle(data) { | ||
|  |   return style([ | ||
|  |     { | ||
|  |       color: data.color, | ||
|  |       'font-size': addUnit(data.size), | ||
|  |     }, | ||
|  |     data.customStyle, | ||
|  |   ]); | ||
|  | } | ||
|  | 
 | ||
|  | module.exports = { | ||
|  |   isImage: isImage, | ||
|  |   rootClass: rootClass, | ||
|  |   rootStyle: rootStyle, | ||
|  | }; |