Vben-admin带搜索框的表格

1.index.vue 页面:

<template>
   <BasicTable @register="register">
   </BasicTable>
</template>

2.注册表格部分:

const [register, {
    reload }] = useTable({
   
      api: getList,   // api接口,返回的数据时数组能正确渲染成功
      columns,        // 数据源,表格头和数据
      rowSelection: {
    type: 'radio' },  // 单选
      bordered: true,       // 边框
      useSearchForm: true,     // 启用搜索框
      showTableSetting: true,
      formConfig: {
   
        labelWidth: 120,  // 搜索区域宽度
        schemas: searchFormSchema, // 搜索的表单项数据源
      },
    });

3.data里的cloums 和 searchFormSchema部分

export const searchFormSchema: FormSchema[] = [
    {
   
      field: 'name',
      label: t('routes.module.enterprise.relation.name'),
      component: 'Input',
      colProps: {
    span: 12 },
    }
  ];
export const columns: BasicColumn[] = [
  {
   
    title: t
  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值