转换文字方式

转换文字方式

方法1:

  getCourseType(value) {
    let texts = { 'ONLINE': '在线', 'OFFLINE': '面授' };
    return texts[value] || '';
  }

方法2:

  // 判断图标
  returnIcon(value) {
    switch (value) {
      case 'pdf': return 'icon-pdffile icon-pdf';
      case 'txt': return 'icon-format-txt icon-txt';
      case 'xls': return 'icon-excel';
      case 'xlsx': return 'icon-excel';
      case 'doc': return 'icon-word';
      case 'docx': return 'icon-word';
      case 'ppt': return 'icon-ppt';
      case 'pptx': return 'icon-ppt';
      default: return 'icon-documents icon-file';
    }
  }

方法3:

  getCourseType(value) {
     if(value=='ONLINE'){ 
         return '在线'
     }else if(value=='OFFLINE'){
         return '面授'
     }
  }

猜你喜欢

转载自blog.csdn.net/Lobove_code/article/details/83542931
今日推荐