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

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

猜你喜欢

转载自www.cnblogs.com/10manongit/p/12742490.html