fastadmin表格 - 自定义接口

1.文本过长溢出

  • 文本超过250px则隐藏,如果需要修改此宽度,请在具体页面中重新定义formatter方法
  • 点击通过弹窗展示完整的内容
  • 弹窗插件使用Layer.js
  • 调用方法
{field: 'content', title: __('Content'), align:'left',formatter: Table.api.formatter.details,events:Table.api.events.details,width:250},
  • 源代码位置require-table.js,在Table.api.events和Table.api.formatter中添加新的字段details
events: {
    details:{
        'click .content-details': function (e, value, row, index) {
            var val = value.replaceAll(' / ',"<br />")
            layer.open({
                title: '详情'
                ,content: val
            })
        },
    }
}
formatter:{
    details:function(value, row, index){
        return `<div style="padding:0 5px; text-overflow:ellipsis; overflow: hidden;max-width:250px;">
        <a href="javascript:;" style="white-space: nowrap;" class="content-details" title="点击展示详情">${value}</a>
        </div>`
    }
}
posted @ 2022-07-06 15:11  ---空白---  阅读(343)  评论(0编辑  收藏  举报