Html 部份
<el-table :data="tableData" style="width: 100%">
<el-table-column type="index" label="排序" min-width="20">
</el-table-column>
<el-table-column min-width="10">
<template slot-scope="scope">
<i class="upward-icon" onclick="moveUp(this)"></i>
<i class="down-icon" onclick="moveDown(this)"></i>
</template>
</el-table-column>
<el-table-column prop="activityImg" label="图片" min-width="30">
<template slot-scope="scope">
<div class="addImg" @change="changeImg(scope.$index,scope.row)">
<i class="iconfont icon-tianjia"></i>
<input type="file">
<span>图片尺寸为:690*247</span>
<img data-src="" :src="scope.row.activityImg" data-holder-rendered="true">
</div>
</template>
</el-table-column>
<el-table-column prop="activityNumber" label="活动编号" min-width="20">
<template slot-scope="scope">
<el-input v-model="scope.row.activityNumber"></el-input>
</template>
</el-table-column>
<el-table-column prop="activityType" label="活动类型" min-width="15">
<template slot-scope="scope">
<el-select v-model="scope.row.activityType" placeholder="请选择场景类别">
<el-option v-for="item in typeVal" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="bookbuytime" label="操作" min-width="15">
<template slot-scope="scope">
<a class="iconfont icon-yichu" v-if="!scope.row.editing" icon="iconfont icon-yichu" @click="handleDelete(scope.$index, scope.row)"></a>
</template>
</el-table-column>
</el-table>
<div style="padding-top:20px;clear:both;overflow:hidden;">
<a class="icon-btn act-addgood" @click="addLine"><i class="iconfont icon-tianjia" style="float: none;margin-right: 5px;"></i>添加活动</a>
<input type="button" class="normalBtn ml10" value="保存" @click="save">
</div>
js部份
methods:{
addLine(){ //添加行数
var newValue = {
activitySort: '',
activityImg: '',
activityNumber: '',
activityType: '大转盘'
};
//添加新的行数
this.tableData.push(newValue);
},
handleDelete(index){ //删除行数
this.tableData.splice(index, 1)
},
save(){
//这部分应该是保存提交你添加的内容
console.log(JSON.stringify(this.tableData))
}
}