iView列表根据状态渲染数据

iView简介

官网:http://v1.iviewui.com/
文档:https://www.iviewui.com/docs/introduce

iView列表根据状态渲染数据

在iView的列表显示中,经常需要根据状态来进行数据文本显示。

columns: [
				{
    
    
                        title: '课程类型',
                        key: 'courseType',
                        width: 100,
                        render:(h,params) => {
    
    
                          let texts = ''
                          if(params.row.publicLevel == 1){
    
    
                            texts = '实践'
                          }else if(params.row.publicLevel == 2){
    
    
                            texts = '实验'
                          }else if(params.row.publicLevel == 3){
    
    
                            texts = '实训'
                          }
                          return h('div',{
    
    },texts)
                        }
                    }

         ]

效果如下图:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u010312671/article/details/106568064