当前位置: 首页 > news >正文

金融业反洗钱培训网站wordpress导航改哪个php文件

金融业反洗钱培训网站,wordpress导航改哪个php文件,willfast优化工具下载,又顺又旺的公司名字[React]基于Antd的FormModal的组件封装以及useFormModal的hooks封装 场景 很常见#xff0c;打开弹窗输入表单等… 封装后#xff0c;弹窗自行挂载到body上#xff0c;只需关注表达逻辑和打开关闭逻辑#xff0c;其它的已经帮你管理好了 源码 import React, { useRef,…[React]基于Antd的FormModal的组件封装以及useFormModal的hooks封装 场景 很常见打开弹窗输入表单等… 封装后弹窗自行挂载到body上只需关注表达逻辑和打开关闭逻辑其它的已经帮你管理好了 源码 import React, { useRef, useMemo, memo, forwardRef, useCallback, useState, useImperativeHandle, useEffect } from react; import { Modal, Form } from antd; import type { ModalProps } from antd; import { createPortal, render, unmountComponentAtNode } from react-dom;export const MyModal memo(forwardRef((props: any, ref) {useEffect(() {console.log(modal had mounted)}, [])const [form] Form.useForm();const [modalChildren, setModalChildren] useStateReact.ReactElement | null(null);const [modalProps, setModalProps] useStateModalProps({visible: false,...(props ?? {})});const typeRef useRefstring();const onFinish useCallback((values: any) {modalProps.onOk?.(values);}, [form, modalProps]);const onClose useCallback(() {if (typeRef.current form) {form.resetFields();}setModalProps((source) ({...source,visible: false,}));}, [form]);const onOpen useCallback(() {setModalProps((source) ({...source,visible: true,}));}, [form]);useImperativeHandle(ref, () ({injectChildren: (element) {setModalChildren(element);},injectModalProps: (props) {console.log(props)setModalProps((source) {return {...source,...props,}});},open: () {onOpen();},close: () {onClose();},setFieldsValue: (values: any) {form.setFieldsValue?.(values);},setType: (type: string) {typeRef.current type;}}), []);const handleOk useCallback((e: any) {if (typeRef.current form) {form.submit();} else {modalProps.onOk?.(e);}}, [form, modalProps]);return (Modal{...modalProps}onCancel{onClose}onOk{handleOk}{modalChildren? React.cloneElement(modalChildren, typeRef.current form? {onFinish,form,onClose,}: { onClose }): null}/Modal) }));interface modalRefType {open: () void;close: () void;injectChildren: (child: React.ReactElement) void;injectModalProps: (props: ModalProps) void;setFieldsValue: (values: any) void;setType: (type: string) void; }interface openArgType extends ModalProps {children?: React.ReactElement,type?: form | default,initialValues?: {[key: string]: any;}, }const useMyModal () {const modalRef useRefmodalRefType();const handle useMemo(() {return {open: ({ children, type, initialValues, ...rest }: openArgType) {console.log(modalRef.current: , modalRef.current);modalRef.current?.setType(type ?? );modalRef.current?.injectChildren(children ?? div111/div);modalRef.current?.injectModalProps(rest);modalRef.current?.open();if (initialValues type form) {modalRef.current?.setFieldsValue?.(initialValues);}},close: () {modalRef.current?.close();}};}, []);const containerRef useRefany(document.createDocumentFragment())useEffect(() {render(createPortal(MyModal keymy-modal ref{modalRef} /, document.body) as any, containerRef.current)return () {unmountComponentAtNode(containerRef.current)}}, [])return [handle] as const; }export default useMyModal 使用Demo const [modalHandler] useMyModal()// 表单组件内容 const AvailabilityForm (props) {return (Formnameavailability_form{...props}Form.Itemnametimerules{REQUIRED_RULE}DatePicker.RangePicker classNamew-full //Form.Item/Form) }// 点击发布 const handlePublish useMemoizedFn(async () {modalHandler.open({title: Available Date,type: form,initialValues: {},children: AvailabilityForm/AvailabilityForm,onOk: async (values: any) {console.log(form vals, values);const timeRes: any[] []console.log(Object.entries(values))Object.entries(values).forEach((item: any) {const timeVal: any[] item[1]if (Array.isArray(timeVal) timeVal.length 2) {timeRes.push({startTime: dayjs(timeVal[0]).utc().valueOf(),endTime: dayjs(timeVal[1]).utc().valueOf(),})}})try {const res await netPublishListing(listingId, {availability: timeRes})if (res) {message.success(Success to publish)fetchItem()modalHandler.close();}console.log(res)} catch (err) {console.log(err: , err);}},destroyOnClose: true,maskClosable: false});})
http://www.pierceye.com/news/274461/

相关文章:

  • 重庆网站编辑职业学校苏州企业网站制作开发
  • 手机网站和电脑网站一样吗wordpress页面镶入文章
  • 深圳个人如何做网站设计用asp做网站题目
  • 视频做网站基础型网站
  • 企业网站外包建设长沙工商注册网上登记
  • 网站建设的费用是多少钱mysql php wordpress
  • 扫二维码做自己网站上海工商注册网官网
  • 阿里云做网站需要些什么软件做一个网站花费多少钱
  • 游戏充值网站怎么做网站被挂马怎么办
  • 电白网站建设代理平台手游
  • 如何让自己做的网页有网站吴江区城乡建设管理局网站
  • 江山网站设计建设银行住房公积网站
  • 网站建设需要注意哪些事项西宁哪里做网站
  • 那个网站做教学视频潍坊市城市建设官网站
  • 建网站有多少种方式玉林市网站开发公司
  • 微网站制作工具龙华新区网站建设
  • 一般做网站需要多少钱怎么免费制作公司网页
  • 网站主机空间网页模板是什么
  • 什么网站做美式软装设计方案深圳网站设计公司费用是
  • 网站制作+网站建设郑州网站建设公司电话多少
  • 网站建设市场需求分析谷歌浏览器最新版本
  • 做网站营销公司做辅食网站
  • 赣州做网站的公司有哪家好和县网站设计
  • 网站建设程序开发电销外呼软件
  • 金坛常州做网站成都分销商城网站建设
  • 网站商城系统建设厦门建站方案
  • 新郑郑州网站建设温州网站定制公司哪家好
  • 系统网站建设公司wordpress 命令行高亮
  • 怎样做招聘网站怎么在拼多多卖东西
  • 网站建设与网站管理网站怎么显示百度名片