element表格加输入框

这篇博客展示了如何使用Vue.js的el-table组件来实现数据的展示、编辑和删除功能。通过el-table-column定义列,利用template slot进行自定义列头和内容,实现了固话号码的编辑(v-model绑定并触发@change事件)以及删除按钮(点击调用removeDomain方法,从数据列表中移除项)。内容主要涉及前端开发中的Vue组件和数据操作。
摘要由CSDN通过智能技术生成
<el-table
                                :data="PersonList"
                                style="width: 100%">
                            <el-table-column
                                    label="员工姓名"
                                    prop="name">
                            </el-table-column>
                            <el-table-column
                                    label="手机号码"
                                    prop="tel">
                            </el-table-column>
                            <el-table-column >
                                <template slot="header" slot-scope="scope">
                                    <span>固话</span>
                                </template>
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.fixedTel" @change="setFixedTel(scope.row)"></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column>
                                <template slot="header" slot-scope="scope">
                                    <span></span>
                                </template>
                                <template slot-scope="scope">
                                    <el-button
                                            size="mini"
                                            type="danger"
                                            @click.prevent="removeDomain(scope.row)">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>

//方法
removeDomain (item) {
                const index = this.PersonList.indexOf(item)
                if (index !== -1) {
                    this.PersonList.splice(index, 1)
                }
            },
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值