riku
8 小时以前 8e3f3890e93d097df4be744648b9ac404d20a558
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var utils = require('../common/utils.wxs');
 
var getListThemeItemClass = function (props) {
  var classPrefix = props.classPrefix;
  var item = props.item;
  var prefix = props.prefix;
  var classList = [classPrefix + '__list-item'];
  if (item.disabled) {
    classList.push(prefix + '-is-disabled');
  }
  return classList.join(' ');
};
 
var getIconData = function (icon) {
  if (utils.isString(icon)) {
    return { name: icon };
  }
 
  if (utils.isNoEmptyObj(icon)) {
    return icon;
  }
 
  return null;
};
 
var isImage = function (name) {
  return name.indexOf('/') !== -1;
};
 
module.exports = {
  getListThemeItemClass: getListThemeItemClass,
  getIconData: getIconData,
  isImage: isImage,
};