1、在option中加入slot:true
{
? ? lable:'交易金額',
? ? prop:'trxAmount',
? ? display:true,
? ? slot:true
}
2奄妨、在vue中
<avue-crud
? ? ?ref="crud"
? ? ?:option="demoOption"
>
<template slot="trxAmount" slot-scope="scope">
? ? ? ? ?{{ scope.row.trxAmount| filterMoney }}
</template>
</avue-crud>
其中slot="trxAmount"的trxAmount要與option中的prop屬性的字段一致
3捎拯、filters要放在props:{}語(yǔ)句上面
filters: {
? ? filterMoney (num) {
? ? ? return (num / 100).toFixed(2)
? ? }
? },
這樣就可以在前端實(shí)現(xiàn)分轉(zhuǎn)元啦~