ElementUI Table中使用 input button等自定义标签

Table中使用<input />

推荐使用

  • 使用template标签 定义scope属性
  • 使用scope.row.xxx 访问当前行的内容
<el-table-column label="价格" min-width="150">
  <template scope="scope">
    <el-input size="small" v-show="scope.row.edit" v-model="editData.unitPrice" type="number" @change="editFunc(scope.row,$event)">
      <template slot="prepend">¥</template>
    </el-input>
    <span v-show="!scope.row.edit">
      <i class="price mark-i">¥ </i>{{scope.row.unitPrice}}
    </span>
  </template>
</el-table-column>
// input 使用需要添加一个指令inline-template
<el-table-column inline-template label="数量" width="200">
  // 绑定数据 v-model="row.xxx" row表示当前行的所有内容
  <el-input-number  v-model="row.id" :controls="false"></el-input-
</el-table-column>
效果
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容