当前位置:网站首页>render后续来了,封装一个表单往表格中添加数据
render后续来了,封装一个表单往表格中添加数据
2022-06-29 14:40:00 【晚星@】
render后续来了,表单往表格中添加数据

<script>
export default {
data() {
return {
tableData: [{
date: '2016-05-02',
name: '王小虎',
age: '男',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
age: '男',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
age: '男',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
age: '男',
address: '上海市普陀区金沙江路 1516 弄'
}],
form: {
name: "name",
sex: "男",
timer: "2022-06-28",
address: "地址",
}
}
},
render: function(createElement) {
const that = this
return createElement('div', {
attrs: {
id: "content"
}
}, [
createElement('div', {
attrs: {
class: "div1"
}
}, [
createElement('el-table', {
style: {
width: '100%',
},
props: {
data: this.tableData,
},
ref: 'extendTable'
}, [
createElement('el-table-column', { props: { prop: "date", label: "日期", align: "center" } }),
createElement('el-table-column', { props: { prop: "name", label: "姓名", align: "center" } }),
createElement('el-table-column', { props: { prop: "age", label: "性别", align: "center" } }),
createElement('el-table-column', { props: { prop: "address", label: "地址", align: "center" } }),
createElement('el-table-column', {
props: { label: "操作", align: "center" },
scopedSlots: {
default: props => createElement('el-button', {
domProps: {
innerHTML: "点击"
},
on: {
click: function() {
console.log(props, '当前行的值', props.row);
},
},
})
},
}),
])
]),
createElement('div', {
attrs: {
class: "div2"
},
style: {
marginTop: "50px",
width: "400px",
textAlign: "left"
}
}, [
createElement('el-button', {
props: {
type: "primary"
},
style: {
marginBottom: "20px"
},
domProps: {
innerHTML: "添加数据"
},
on: {
click: function() {
that.tableData.push({
date: that.form.timer,
name: that.form.name,
age: that.form.sex,
address: that.form.address
})
}
}
}),
createElement('el-form', {
props: {
labelWidth: "80px"
},
ref: 'form1'
}, [
createElement('el-form-item', {
props: {
label: "姓名",
}
}, [
createElement('el-input', {
props: {
value: that.form.name
},
on: {
input: function(event) {
that.form.name = event
}
}
})
]),
createElement('el-form-item', {
props: {
label: "性别"
}
}, [
createElement('el-select', {
props: {
value: that.form.sex
},
on: {
change: function(event) {
that.form.sex = event
}
}
}, [
createElement('el-option', {
props: {
label: "男",
value: "男"
}
}),
createElement('el-option', {
props: {
label: "女",
value: "女"
}
})
])
]),
createElement('el-form-item', {
props: {
label: "日期"
}
}, [
createElement('el-date-picker', {
props: {
value: that.form.timer,
type: 'date',
valueFormat: 'yyyy-MM-dd'
},
on: {
input: function(event) {
that.form.timer = event
}
}
})
]),
createElement('el-form-item', {
props: {
label: "地址"
}
}, [
createElement('el-input', {
props: {
type: "textarea",
value: this.form.address
},
on: {
input: function(event) {
that.form.address = event
},
}
})
])
]
)]
)]
)
},
}
</script>
边栏推荐
- Chapter 13 event operation of canvas
- Chapter 7 deformation operation of canvas
- Indice d'évaluation du logiciel hautement simultané (site Web, interface côté serveur)
- 卫龙更新招股书:年营收48亿 创始人刘卫平家族色彩浓厚
- Chapter 6 picture operation of canvas
- Evaluation index of high concurrency software (website, server interface)
- Build your own website (19)
- Laravel - Composer 安装指定 Laravel 版本
- Configuration tutorial for swagger2
- 三角函数对应在平面坐标上画圆
猜你喜欢

二级指针

Campus errands wechat applet errands students with live new source code

阿尔兹海默病智能诊断

三角函数对应在平面坐标上画圆

驱动器实际运用案例

Practical application cases of drives

信息学奥赛一本通2061:梯形面积

Heavyweight! The latest SCI impact factors were released in 2022, and the ranking of the three famous journals NCS and the top10 of domestic journals has changed (the latest impact factors in 2022 are

部署搭建decentraland流程讲解

MCS:离散随机变量——Hyper Geometric分布
随机推荐
期货开户可以线下开户吗?在网上开户安全吗?
URL encoding in Delphi7
仿头条新闻资讯dz模板 Discuz新闻资讯商业版GBK模板源码
June 27 talk SofiE
word如何自动生成目录
PostgreSQL learning (based on rookie course)
捷氢科技冲刺科创板:拟募资10.6亿 上汽集团是大股东
在平面坐标上画斜线
FIFO implementation with single port RAM
校园转转二手市场源码
Chapter 5 text operation of canvas
Is 100W data table faster than 1000W data table query in MySQL?
CKS CKA CKAD 将终端更改为远程桌面
Digital IC code -- traffic lights
Unity C# 基础复习27——委托示例(P448)
Kubernetes pod troubleshooting guide
MySQL中100w数据表比1000w数据表查询更快吗?
微信公众号—菜单
Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear
信息学奥赛一本通2062:电影票