iview table表中使用render函数props传值出现问题

2023-05-25,,

使用iview中的table表格时避免不了使用render函数渲染自定义内容,或者渲染组件。但是在正常使用时出现了props传值无法识别,

按照官网介绍使用props如下:

render: (h, params) => {
return h('div', [
h('Input', {
props: {
value: params.row.maxCommissionAmount,
type: 'number',
min:'0'
},
style: {
width: '100%',
height: '25px',
border: '1px solid #dcdee2',
borderRadius: '4px',
textAlign: 'center',
outline: 'none',
}, })
])
}

直接使用props赋值无法识别

要将props转写成domProps,这样就可以正常传值啦

render: (h, params) => {
return h('div', [
h('Input', {
domProps: {
value: params.row.maxCommissionAmount,
type: 'number',
min:'0'
},
style: {
width: '100%',
height: '25px',
border: '1px solid #dcdee2',
borderRadius: '4px',
textAlign: 'center',
outline: 'none',
}, })
])
}

本文转载于:猿2048→https://www.mk2048.com/blog/blog.php?id=h01ki2jh2bb

iview table表中使用render函数props传值出现问题的相关教程结束。

《iview table表中使用render函数props传值出现问题.doc》

下载本文的Word格式文档,以方便收藏与打印。