Git Product home page Git Product logo

Comments (4)

lijileiGood avatar lijileiGood commented on July 19, 2024

或者是其他的方案, 官网文档只是5.xx版本. 但5.1和5.18版本总会有些许区别, 只看最新文档误导人

from ant-design.

Wxh16144 avatar Wxh16144 commented on July 19, 2024
image

from ant-design.

zombieJ avatar zombieJ commented on July 19, 2024

antd 从 v3 起已经原生支持 typescript 了,不需要额外安装 @types/antd 哈~

from ant-design.

lijileiGood avatar lijileiGood commented on July 19, 2024

@zombieJ @Wxh16144
感谢, 是我提错地方了
还有个问题, 麻烦解答一下, 后面为问题描述, 不知道/不回复也没事 提前感谢,
问题: umijs 和 ant-design-pro 是否也原生支持了ts?
ahooks 经我确认和ant-design-pro特有的组件现象类似, 也就是不原生支持ts吧.

我司都是Javaer, 主程使用umijs max 生成的前端项目, 里面用到了ant-design-pro, 这是为了说明我们不精通前端, 且项目封装的很深.

      import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
      <ModalForm<API.InstanceRemarkParam>
        title="修改备注"
        trigger={<EditTwoTone />}
        modalProps={{ destroyOnClose: true }}
        onFinish={onFinish}
      >
        <ProFormTextArea
          allowClear
          name={'remark'}
          initialValue={props.remark}
        ></ProFormTextArea>
      </ModalForm>

从ModalForm点进去, 有注释, 说明直接用的antd吧

    /**
     * 接收任意值,返回 真值 会关掉这个抽屉
     *
     * @name 表单结束后调用
     *
     * @example 结束后关闭抽屉
     * onFinish: async ()=> {await save(); return true}
     *
     * @example 结束后不关闭抽屉
     * onFinish: async ()=> {await save(); return false}
     */
    onFinish?: (formData: T) => Promise<any>;
    /** @name 提交数据时,禁用取消按钮的超时时间(毫秒)。 */
    submitTimeout?: number;

从ProFormTextArea点进去无注释

import type { TextAreaProps } from 'antd/lib/input';
import type { TextAreaRef } from 'antd/lib/input/TextArea';
import React from 'react';
declare const _default: React.ForwardRefExoticComponent<{
    fieldProps?: Partial<import("../../typing").FieldProps<TextAreaRef> & TextAreaProps> | undefined;
    placeholder?: string | string[] | undefined;
    secondary?: boolean | undefined;
    cacheForSwr?: boolean | undefined;
    disabled?: boolean | undefined;
    width?: number | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
    proFieldProps?: import("../../../../utils/src").ProFieldProps | undefined;
    footerRender?: import("../../typing").LightFilterFooterRender | undefined;
    children?: any;
} & Omit<import("..").ProFormItemProps, "valueType"> & Pick<import("../../typing").ProFormGridConfig, "colProps"> & import("../../typing").ExtendsProps & React.RefAttributes<any>>;
export default _default;

另外proform这样

import type { CommonFormProps } from '../../BaseForm';
export type ProFormProps<T = Record<string, any>, U = Record<string, any>> = Omit<FormProps<T>, 'onFinish'> & CommonFormProps<T, U>;
declare function ProForm<T = Record<string, any>>(props: ProFormProps<T> & {
    children?: React.ReactNode | React.ReactNode[];
}): import("react/jsx-runtime").JSX.Element;
declare namespace ProForm {
    var Group: React.FC<import("../..").GroupProps>;
    var useForm: typeof import("antd/es/form/Form").useForm;
    var Item: React.FC<import("../../components").ProFormItemProps>;
    var useWatch: typeof import("rc-field-form/es/useWatch").default;
    var ErrorList: React.FC<import("antd/es/form").ErrorListProps>;
    var Provider: React.FC<import("antd/es/form/context").FormProviderProps>;
    var useFormInstance: typeof import("antd/es/form/hooks/useFormInstance").default;
    var EditOrReadOnlyContext: React.Context<{
        mode: "read" | "edit" | "update";
    }>;
}
export { ProForm };

from ant-design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.