当前位置: 首页 > news >正文

vue动态生成行

vue代码

<el-table :data="form.lineInfos" :border=true style="width: 99.99%;">

                    <el-table-column type="index" label="序号" width="50"></el-table-column>

                    <el-table-column prop="unitPrice" label="单价" width="150">

                        <template slot-scope="scope">

                            <el-input-number v-model="scope.row.unitPrice" controls-position="right"  

                            :min="1" :precision="2" :max="999999" size="small"

                            @blur="unitPriceInput($event)"></el-input-number>

                        </template>

                    </el-table-column>

                    <el-table-column prop="deliverCharge" label="送货费" width="150">

                        <template slot-scope="scope">

                            <el-input-number v-model="scope.row.deliverCharge" controls-position="right"  

                            :min="1" :precision="2" :max="999999" size="small"></el-input-number>

                        </template>

                    </el-table-column>

                    <el-table-column prop="landingCharge" label="卸货费" width="150">

                        <template slot-scope="scope">

                            <el-input-number v-model="scope.row.landingCharge" controls-position="right"  

                            :min="1" :precision="2" :max="999999" size="small"></el-input-number>

                        </template>

                    </el-table-column>

                    <el-table-column prop="totalPrice" label="总价" width="150">

                        <template slot-scope="scope">

                        <el-input v-model="scope.row.totalPrice" id="totalPrice" size="small" placeholder="请输入" />

                        </template>    

                    </el-table-column>

                    <el-table-column prop="startRoute" label="起始线路" width="350">

                        <template slot-scope="scope">

                            <el-input v-model="scope.row.startRoute"   placeholder="请输入终点线路" />

                        </template>

                    </el-table-column>

                    <el-table-column prop="endRoute" label="终点线路" width="350">

                        <template slot-scope="scope">

                            <el-input v-model="scope.row.endRoute"   placeholder="请输入终点线路" />

                        </template>

                       

                    </el-table-column>

                    <el-table-column label="操作" width="100">

                        <template slot-scope="scope">

                            <el-button size="mini" type="danger" plain @click="removeLineInfos(scope.$index, scope.row)">删除</el-button>

                        </template>

                    </el-table-column>

                </el-table>

js代码

export default {

    name: "LineEdit",

    data() {

        return {

                

                form: {

                        lineInfos: [{

                            value: ''

                        }],

            }

                }

            }

        

// 动态删除行

        removeLineInfos(index, row){

            var that = this;

            this.$confirm('确认删除吗?', '提示', {

            confirmButtonText: '确定',

            cancelButtonText: '取消',

            type: 'warning'

            }).then(() => {

                //点击确定的操作(调用接口)

                var lineInfos = that.form.lineInfos;

                for (var i = 0; i < lineInfos.length; i++) {

                    if (row.id == lineInfos[i].id) {

                        that.form.lineInfos.splice(i, 1);

                    }

                }

                }).catch(() => {

                //点取消的提示

                    return;

                });

        },

        // 动态增加行

        addLineInfos(){

            var member = this.form.lineInfos;

            console.log(member);

            var length = member.length;

            this.form.lineInfos.push(

            {

                id: parseInt(length),

                name: '',

                relationship: '',

                mobile: '',

                birthday: '',

                gongzuodanwei: '',

            });

        },

}   

 

http://www.lryc.cn/news/114826.html

相关文章:

  • IPC之一:使用匿名管道进行父子进程间通信的例子
  • 前端将页面转化为图片---进行下载导出、打印等功能
  • docker安装code-service在线开发vscode工具及node版本过低问题
  • C++ 多态深入解析
  • C#使用EmguCV播放视频
  • LeetCode150道面试经典题-买卖股票的最佳时机(简单)
  • 【积水成渊】CSS磨砂玻璃效果和渐变主题色文字
  • JVM、JRE、JDK三者之间的关系
  • input 标签的 type 属性有哪些值?分别表示什么意思?
  • (十五)大数据实战——hive的安装部署
  • MySQL安装和卸载
  • ELK、ELFK日志分析系统
  • JVM基础篇-StringTable
  • 探秘手机隐藏的望远镜功能:开启后,观察任何你想看的地方
  • 正运动亮相2023半导体设备材料与核心部件展示会,助力半导体产业高速高精应用
  • 如何在MongoDB中添加新用户
  • 幻读怎么复现
  • 无脑入门pytorch系列(二)—— torch.mean
  • ansible-kubeadm在线安装高可用K8S集群v1.19-v1.20版本
  • Cesium entity 渐隐渐显、闪烁
  • LISA:通过大语言模型进行推理分割
  • opencv基础40-礼帽运算(原始图像减去其开运算)cv2.MORPH_TOPHAT
  • php中的array_filter()函数
  • ArcGIS Pro基础:【按顺序编号】工具实现属性字段的编号自动赋值
  • neo4j终端操作
  • 【深度学习】在 MNIST实现自动编码器实践教程
  • SpringBoot3基础用法
  • 6、移除链表元素
  • 大厂容器云实践之路(一)
  • 《合成孔径雷达成像算法与实现》Figure3.1