element-ui el-table 自定义字体颜色快捷复用方法

第一步:自定义模板把后台返回的参数传入以下方法中

        
        ```
#v-html 中方法如下  methods 中使用 
```getinfo(item,key,isalert){   // 审核状态 和 项目类型
            if(item){
                if(isalert){
                   return `${item.title}`
                }
                   return `${item.title}`
            }else{
              return ''
            }
        } ```
#然后在data return 中 定义自定义颜色
  ``` status:{      // 审核状态信息
              _1:{title:'待审核',color:'rgb(255,215,0)'},
              _2:{title:'已审核',color:'rgb(50,205,50)'},
              _3:{title:'驳回',color:'rgb(220,220,220)'},
              _4:{title:'下线',color:'rgb(255,0,0)'},
              _5:{title:'删除',color:'rgb(0,0,0)'}
            },```


##以下是完整页面HTML代码

![image.png](https://upload-images.jianshu.io/upload_images/1416460-ae7af8e8fb9cc04e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

# 完成后的效果
![QQ图片20181116150707.png](https://upload-images.jianshu.io/upload_images/1416460-b7d727bece1f6c9c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

你可能感兴趣的:(element-ui el-table 自定义字体颜色快捷复用方法)