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.
39 lines
747 B
39 lines
747 B
/* 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 != 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, |
|
};
|
|
|