美文网首页
elementui使用记录

elementui使用记录

作者: xurna | 来源:发表于2020-11-30 17:47 被阅读0次

    前言

    本文主要记录在开发过程中遇到的官方文档上没有讲的很细的点,及一些比较棘手的处理方案,方便后面查看。

    记录点

    • 表格中的数据还是数组
      数据格式:
    {"绑定URL": [{v: "1", url: "xxx1"},{v: "2", url: "xxx2"},{v: "3", url: "xxx3"},]}
    
    <el-table-column label="绑定URL" prop="绑定URL" width="500">
            <template slot-scope="{row,}">
              <div  v-for="(item2,index) in row['绑定URL']" :key="index">
                版本:{{item2.v}},url:{{item2.url}}
              </div>
             </template>
    </el-table-column>
    
    • 不固定的表项
      预处理:将表项提取处理
    <el-table
          :data="tableChunkData[currentPage-1]"
          border
          @sort-change="sortChange($event,'dataList')"
        >
          <el-table-column
            v-for="(col, i) in tableKey"
            :key="`tableKey-${i}`"
            height="50px"
            :prop="col"
            :label="col.replace('2020-','')"
            :fixed="col == '业务渠道'?true:false"
            :sortable="col == '业务渠道'?false:'custom'"
          >
            <template slot-scope="scope">
              <span :class="[scope.row[col] < 0 || (col == '涨/降幅' && scope.row['negative'])? 'red': '']">{{scope.row[col]}}</span>
            </template>
          </el-table-column>
    </el-table>
    

    相关文章

      网友评论

          本文标题:elementui使用记录

          本文链接:https://www.haomeiwen.com/subject/ybqdwktx.html