记录一个问题,使用element-table时,渲染多条数据仅展示一个输入框,其他数据根据输入框输入值渲染

        记录一个问题,遇到一个需求,使用element-table时,渲染多条数据仅展示一个输入框,其他数据根据输入框输入值渲染

        要实现的样式:

        此问题可使用 element-table index 来解决,这里只是加了 input 框的禁用,需要其他样式可以增加 v-if 来渲染其他 dom

<el-table-column 
  width="160" 
  align="center" 
  label="其他" 
  type="index" // 设置 type = index 属性,设置后默认宽度为50,需要自己加宽度
>    <template slot-scope="scope">
        <el-input type="text"
        v-model="agentCapitalPriceRequestVO.agentPrice"
        :disabled="!(scope.$index == 0)" // 禁用方式,借用 index 来禁用想要金庸的条件,但是需要加 $ 符号,如果想要禁用多个,可以自己设置禁用条件,这里只设置一个
        />
    </template>
</el-table-column>

猜你喜欢

转载自blog.csdn.net/z_langjitianya/article/details/131223335