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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM