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

部门网站建设的工作汇报青海住房建设网站

部门网站建设的工作汇报,青海住房建设网站,中国设计最好的网站,云服务器拿来做网站文章目录一、引子二、配置使用1.安装2.使用#xff08;1#xff09;直接调用#xff08;2#xff09;赋值到表单#xff08;Form#xff09;#xff08;3#xff09;自定义功能按钮#xff08;4#xff09;隐藏指定 Tab#xff08;5#xff09;其他三、常见问题及解… 文章目录一、引子二、配置使用1.安装2.使用1直接调用2赋值到表单Form3自定义功能按钮4隐藏指定 Tab5其他三、常见问题及解决1.兼容低版本 antd 或高版本 react2.useForm 相关报错3.setState inside useEffect 死循环四、拓展学习1.cron表达式翻译 —— cronstrue2.其他 cron 相关 npm 库包含 vue 相关react-cron-generatorvuevcrontabvue-cron-23.在线工具一、引子 Cron 表达式相关知识详见【实战】Linux基础知识必学 —— 定时任务 qnn-react-cron 可以看做 react-cron-antd 的升级版具体“渊源”可见文档现有功能如下 全面支持 cron秒、分、时、日、月、周、年 日及周条件互斥自动改变响应值 支持反解析 cron 表达式到 UI 可结合此组件与 Antd 的下拉及输入组件封装成下拉输入框 国际化支持 TypeScript 支持 直到现在作者依旧在维护这篇文章之前最新库更新日期2023.03.02 npmhttps://www.npmjs.com/package/qnn-react-crongithub: https://github.com/wangzongming/qnn-react-cron . 二、配置使用 1.安装 yarn add qnn-react-cron | npm i qnn-react-cron这一步遇到依赖不兼容问题可见后面内容:三、常见问题及解决 2.使用 引用 import React from react; import Cron from qnn-react-cron;1直接调用 Cron /啊哈有点简单这样只能显示进行被隔离的操作若要与页面其他组件联动接着往下看。 默认生成表达式并赋值到变量 import React, { useState } from react; import Cron from qnn-react-cron;export default () {const [cronValue, setCronValue] useState()return Cronvalue{cronValue}onOk{setCronValue}/ }Cron onOk{setCronValue}/ 是 Cron onOk{value setCronValue(value)}/ 的简写 2赋值到表单Form 或是使用了表单Form比如需要将表达式赋值到 input 框中 import React from react; import Cron from qnn-react-cron;export default () {const { getFieldValue, setFieldsValue } props.formreturn Cronvalue{getFieldValue(cronValue)}onOk{value setFieldsValue({ cronValue: value})}/ }这样点击 生成 按钮即可赋值到 input 框中在 input 框中修改也能同步到组件中。 3自定义功能按钮 但是组件默认带了两个按钮解析到UI、生成要想隐藏 解析到UI 按钮只能将两个按钮全部都走自定义有其他想要的功能比如 重置 也能使用下面的自定义按钮 import React, { useState } from react; import { Button } from antd; import Cron from qnn-react-cron;export default () {const { getFieldValue, setFieldsValue } props.formconst [fns, setFns] useState({})return Cronvalue{getFieldValue(cronValue)}// 相当于 refgetCronFns{setFns}// 自定义底部按钮后需要自行调用方法来或者值footer{[//默认值Button style{{ marginRight: 10 }} onClick{()fns.onParse()}解析到UI/ButtonButton typeprimary onClick{()setFieldsValue({ cronValue: fns.getValue()}))}生成/Button]}/ }若是组件用在模态框Modal中组件和模态框在右下方都有按钮可以隐藏默认按钮并将按钮功能解析到UI、生成提取到其他地方比如输入框Input的右侧 import Cron from qnn-react-cron; import { Form, Input, Button } from antd // import { useState } from react;const CronIndex () {// const [cronRef, setCronRef] useState()let cronRefconst [ form ] Form.useForm()const { getFieldValue, setFieldsValue } formreturn Form form{form}Form.Item label任务周期 namecronValueInput addonAfter{( Buttontypeprimarystyle{{ margin: -1px -12px, border: none }}onClick{() setFieldsValue({ cronValue: cronRef.getValue() })}生成/Button)}//Form.ItemCronvalue{getFieldValue(cronValue)}getCronFns{fns cronRef fns}// getCronFns{setCronRef}footer{[]}//Form }export default CronIndex此时效果输入框 实时同步 到组件组件中变化在点击生成按钮时同步到输入框如图 getCronFns 中对于 cronRef 值的获取不建议使用 useState代码中有相关示例已注释掉感兴趣的可以尝试一下 ,会引起报错Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn’t have a dependency array, or one of the dependencies changes on every render. 4隐藏指定 Tab 配置面板的隐藏与显示默认如下 Cron// 配置面板的隐藏, false 即隐藏panesShow{{second: true,minute:true,hour: true,day: true,month:true,week:true,year:true,}}// 默认显示哪个面板, 默认为 second 如果隐藏了 second 需要自行设置defaultTab{second} /隐藏秒默认显示分钟的设置如下 Cron panesShow{{ second: false }} defaultTab{minute} /默认值是* * * * * ? *因此在隐藏某个面板时要做好对该部分隐藏值的处理 5其他 博主这里没有用到语言国际化配置如有需要请参考文末官方文档 三、常见问题及解决 1.兼容低版本 antd 或高版本 react 博主在记录这篇博文时安装的版本是qnn-react-cron1.0.4所支持主要依赖版本 antd“^4.5.2”react“^15.0.0 || ^16.0.0 || ^17.0.0” 若是项目时用的还是比较老的 antd 版本或是 react 版本高于 qnn-react-cron 所依赖版本在安装依赖时会发生如下报错 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: npm-test0.1.0 npm ERR! Found: react18.2.0 npm ERR! node_modules/react npm ERR! react^18.2.0 from the root project npm ERR! peer react16.9.0 from antd4.24.8 npm ERR! node_modules/antd npm ERR! peer antd^4.5.2 from qnn-react-cron1.0.4 npm ERR! node_modules/qnn-react-cron npm ERR! qnn-react-cron* from the root project npm ERR! 1 more (react-dom) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react^15.0.0 || ^16.0.0 || ^17.0.0 from qnn-react-cron1.0.4 npm ERR! node_modules/qnn-react-cron npm ERR! qnn-react-cron* from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! ...不要慌解决办法就在报错日志中顺便学习英语了嘻嘻 关键词peer匹配的对等的关键句Fix the upstream dependency conflict, or retry修复上游依赖冲突,或重试 原因npm 7.x 之前的版本遇到依赖冲突会忽视依赖冲突继续进行安装npm 7.x 版本开始不会自动进行忽略需要用户手动输入命令两种选择 –force 无视冲突强制获取远端npm库资源 覆盖之前–legacy-peer-deps 忽视依赖冲突,继续安装不覆盖之前 npm install vue-router --force 或者 npm install vue-router --legacy-peer-deps2.useForm 相关报错 参见【已解决】Instance created by useForm is not connected to any Form element. Forget to pass form prop 3.setState inside useEffect 死循环 Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn’t have a dependency array, or one of the dependencies changes on every render. 详见二.2.(3)案例或博主在大佬提的issues下再次提问https://github.com/wangzongming/qnn-react-cron/issues/21 四、拓展学习 1.cron表达式翻译 —— cronstrue npmhttps://www.npmjs.com/package/cronstrue 2.其他 cron 相关 npm 库包含 vue 相关 react-cron-generator npmhttps://www.npmjs.com/package/react-cron-generatordemohttps://sojinantony01.github.io/react-cron-generator/ vuevcrontab npmhttps://www.npmjs.com/package/vcrontabdemohttps://small-stone.github.io/vCrontab/dist/ vue-cron-2 npmhttps://www.npmjs.com/package/vue-cron-2demohttps://1615450788.github.io/vue-cron/dist/index 搜索其他 vue cron 相关https://www.npmjs.com/search?rankingpopularityqvue-cron (排序条件Optimal匹配度Popularity受欢迎度Quality质量Maintenance维护时间) 3.在线工具 quartz/Cron/Crontab表达式在线生成工具-BeJSON.com在线Cron表达式生成器pppet在线Cron表达式生成器qqe2 npmqnn-react-cron - npm over
http://www.hkea.cn/news/14590309/

相关文章:

  • 合肥网络科技有限公司做网站北京 网站建设|小程序|软件开发|app开发公司
  • 深圳朝阳电子网站建设WordPress花将军
  • 直播视频网站如何做wordpress手机实现打赏功能
  • 网站建设服务费怎么做会计分录下载了字体如何安装在wordpress
  • 长沙专业外贸网站建设ui网站一般建好大
  • 东莞最新网站建设软件网站建设配置文件无法粘贴
  • 做i网站旅游网页代码
  • 网站建设网络营销平台 云搜系统网站访问过程
  • 网站空间管理平台网站建设类岗位杭州
  • 主机托管网站wordpress怎么加友链
  • 湛江网站建设团队WordPress的cookie
  • 黑河商城网站建设公司网站建设需求分析
  • 央企 网站建设 公司渭南做网站哪家好
  • 阿里云建设网站好不好酒水招商加盟网
  • 临清网站优化做网站第一次见客户
  • 昆山做网站公司哪家好网站页脚设计的几个小技巧
  • 如何在网站上做标记圈信息h5制作成品
  • 简单扁平化风格后台网站模板深度网站建设
  • 泉州厦门网站建设公司国家工商企业注册查询系统官网
  • 泉州建设系统培训中心网站wordpress 链接修改
  • 中国最有名的建设网站查企业电话软件哪个好
  • 佛山专业做淘宝网站cadisen卡迪森手表网站
  • 网站底部特效邓州网络推广有效的方法
  • 昆明网站建设推广wordpress放大镜没用
  • app推广的网站响应式设计的网站
  • 城市建设模拟游戏网站连接国外网站做端口映射
  • 小地方的旅游网站怎么做做黑网站赚钱吗
  • 网站编辑是什么工作wordpress如何修改用户名密码
  • 广州建设网站网站定制的公司哪家好
  • 建站公司联系电话网站第二次备案