马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ant design pro 怎样去生存颜色
- ant design pro v6 怎样做好脚色管理
- ant design 的 tree 怎样作为脚色中的权限选择之一
- ant design 的 tree 怎样作为脚色中的权限选择之二
- ant design pro access.ts 是怎样控制多脚色的权限的
- ant design pro 中用户的表单怎样控制多个脚色
- ant design pro 怎样实现动态菜单带上 icon 的
- ant design pro 的表分层级如那边理
- ant design pro 如那边理权限管理
- ant design pro 本事之自制复制到剪贴板组件
像上图那样,我们常常给列表页做分类的,
这种多标签如那边理呢?
肯定是要得到动态数据对吧。
每次点击的时间要发哀求,得到差别的数据。
实在 ant design pro 是支持的。
在 index.tsx 中的 protable 里加上这个就好。
- toolbar={
-
- {
-
-
- menu: {
-
-
- type: 'tab',
- activeKey: activeKey,
- items: [
- {
-
-
- label: <FormattedMessage id="platform.all" defaultMessage="All" />,
- key: '',
- },
- {
-
-
- label: <FormattedMessage id="platform.online" defaultMessage="Online" />,
- key: 'true',
- },
- {
-
-
- label: <FormattedMessage id="platform.offline" defaultMessage="Offline" />,
- key: 'false',
- },
- ],
- onChange: (key: any) => {
-
-
- setActiveKey(key);
- if (actionRef.current) {
-
-
- actionRef.current.reload();
- }
- },
- },
- }}
复制代码 完备代码是如许的:
- import {
-
- addItem, queryList, removeItem, updateItem } from '@/services/ant-design-pro/api';
- import {
-
- PlusOutlined } from '@ant-design/icons';
- import type {
-
- ActionType, ProColumns, ProDescriptionsItemProps } from '@ant-design/pro-components';
- import {
-
- FooterToolbar, PageContainer, ProTable } from '@ant-design/pro-components';
- import {
-
- FormattedMessage, useAccess } from '@umijs/max';
- import {
-
- Button, message, Modal, Switch, Tooltip } from 'antd';
- import React, {
-
- useRef, useState } from 'react';
- import type {
-
- FormValueType } from './components/Update';
- import Update from './components/Update';
- import Create from './components/Create';
- import Show from './components/Show';
- import {
-
- useIntl } from '@umijs/max';
- import {
-
- carTypeMap } from '@/utils/constants';
- import CopyToClipboard from '@/components/CopyToClipboard';
- import ConfigureForm from './components/ConfigureForm';
- /**
- * @en-US Add node
- * @zh-CN 添加节点
- * @param fields
- */
- const handleAdd = async (fields: API.ItemData) => {
-
-
- const hide = message.loading(<FormattedMessage id="adding" defaultMessage="Adding..." />);
- try {
-
-
- await addItem('/platforms', {
-
- ...fields });
- hide();
- message.success(<FormattedMessage id="add.success" defaultMessage="Added successfully" />);
- return true;
- } catch (error: any) {
-
-
- hide();
- message.error(
- error?.response?.data?.message ?? (
- <FormattedMessage id="add.failed" defaultMessage="Adding failed, please try again!" />
- ),
- );
- return false;
- }
- };
- /**
- * @en-US Update node
- * @zh-CN 更新节点
- *
- * @param fields
- */
- const handleUpdate = async (fields: FormValueType) => {
-
-
- const hide = message.loading(<FormattedMessage id="updating" defaultMessage="Updating..." />);
- try {
-
-
- await updateItem(`/platforms/${
-
- fields._id}`, fields);
- hide();
- message.success(<FormattedMessage id="update.success" defaultMessage="Updated successfully" />);
- return true;
- } catch (error: any) {
-
-
- hide();
- message.error(
- error?.response?.data?.message ?? (
- <FormattedMessage id="update.failed" defaultMessage="Update failed, please try again!" />
- ),
- );
- return false;
- }
- };
- /**
- * Delete node
- * @zh-CN 删除节点
- *
- * @param selectedRows
- */
- const handleRemove = async (ids: string[]) => {
-
-
- const hide = message.loading(<FormattedMessage id="deleting" defaultMessage
复制代码 |