账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    怎么在Element UI的table里面控制列是否是自定义列模板?
    23
    0

    我想通过header.multipleRow去控制是否是自定义的,但是没用,后来又在外面包裹一层也不行~
    我感觉是slot-scope不能用v-if去控制的原因

    <el-table-column v-for="(header, index) of tableHeaders" :sortable="header.sortable" :type="header.type" :prop="header.prop" :label="header.label" :width="header.width" :key="index">
        <div slot-scope="scope" v-if="header.multipleRow">
          <div class="biz-customcol">
            <img :src="scope.row[header.prop].img" alt="">
            <div class="biz-two-row">
              <span style="margin-left: 10px">{{ scope.row[header.prop].value1 }}</span>
              <span style="margin-left: 10px">{{ scope.row[header.prop].value2 }}</span>
            </div>
          </div>
        </div>
    </el-table-column>
    <el-table-column v-for="(header, index) of tableHeaders" :sortable="header.sortable" :type="header.type" :prop="header.prop" :label="header.label" :width="header.width" :key="index">
      <div v-if="header.multipleRow">
        <div slot-scope="scope">
          <div class="biz-customcol">
            <img :src="scope.row[header.prop].img" alt="">
            <div class="biz-two-row">
              <span style="margin-left: 10px">{{ scope.row[header.prop].value1 }}</span>
              <span style="margin-left: 10px">{{ scope.row[header.prop].value2 }}</span>
            </div>
          </div>
        </div>
      </div>
    </el-table-column>
    0
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    • 唯我独甜 普通会员 1楼

      在Element UI的table中,可以通过设置rowSpan属性来控制列是否是自定义列模板。rowSpan属性用于设置行中的元素数量,如果设置为auto,则默认是auto,表示行中的元素数量自动计算。如果设置为min,则表示行中的元素数量必须是min。

      例如:

      ```html

      Item {{ item.name }}
      {{ item.name }}

      ```

      在这个例子中,每行的item都是一个对象,其中name是属性名,index是属性值。rowSpan属性被设置为3,这意味着每行最多有3个元素。这样,当items的长度小于3时,每行的元素数量将自动计算。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部