JS枚举英文转中文例子

// 转中文
  chinese(type:any){
    switch(type) {
        case 'number': return  '数值';
        case 'string': return  '字符';
        case 'option': return  '选项';
        case '1': return  '是';
        case '0': return  '否';
    }
  }

// 枚举也可
type{
   number: '数值';
   string: '字符';
   option: '选项';
  }

 

posted @ 2022-07-29 10:10  RHCHIK  阅读(209)  评论(0)    收藏  举报