fastadmin框架前台常用语句

本文总结了FastAdmin框架中常用的前端操作,包括引入外部JS、字段的显示隐藏、搜索方式改造、字段判断效果、添加按钮、事件绑定、页面Tab切换、内容截断、自定义页面集成框架插件、元素事件处理以及弹窗应用等,旨在帮助开发者提升在FastAdmin项目中的前端开发效率。
摘要由CSDN通过智能技术生成

1.引入外部js并调用

require(['spectrum'], function (spectrum) {
   
    var col = $("#c-mcolor").val();
    $("#c-mcolor").spectrum({
   
        color: col,
        preferredFormat: "hex",
        showInput: true,
    });

    var gcol = $("#c-mbgcolor").val();
    $("#c-mbgcolor").spectrum({
   
        color: gcol,
        preferredFormat: "hex",
        showInput: true,
    });

});

2.隐藏某字段的显示和隐藏通用搜索

//visible隐藏字段,operate隐藏通用搜索
{
   field: 'id', title: __('Id'),visible: false,operate: false},

3.通用搜索改为select搜索
js代码

//data是添加属性
 {
   field: 'reptype', title: __('Reptype'),searchList: $.getJSON("ajax/reptype"),data:' id = "mm_city" '},
 //或者直接写
 {
   field: 'status', title: __('status'), searchList: {
   "0":__('待审核'),"1,2,3":__('已审')}},

ajax控制器中代码

public function reptype(){
   

    $areaList = Db::name('report_type')->field('id,name')->select();
    return json($areaList);
}

4.给某字段添加判断效果

{
   field: 'createtime', title: __('Createtime'), formatter:function(value,row,index){
   
    if( 0 < value && value <= 3){
   
        return '<b style = "color:red">' + value + '天</b>';
    }else{
   
        return value + "天" ;
    }   
}},

5.在操作中添加按钮

{
   field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [{
   
           name: 'det
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值