使用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