自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 资源 (4)
  • 收藏
  • 关注

原创 typeorm自动生成实体类

可以使用typeorm-cli自动生成1. 安装typeorm-clinpm nstall -g typeorm-cli2. 使用安装好之后就可以在 typeorm项目根目录下允许 typeorm-cli 就可以了3 配置在更目录下的 ormconfig.json 添加配置4 自定义模板在根目录下添加 ormEntityTemplate.ejs 文件,实现自定义模版5 注意目前仅测试了 mysql命名规则采用下划线区分如果当前生成的和上次的不一样,会自动备份一次...

2020-05-24 21:57:48 2341

原创 failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to copy: httpRe

Docker build 报错

2022-11-04 16:25:27 1827 1

原创 -webkit-background-clip属性不生效问题

将-webkit-text-fill-color改成color并且调整顺序。-webkit-background-clip属性不生效问题。试了好久,终于找到原因了,泪目( Ĭ ^ Ĭ )在浏览器勾选样式后又能够显示,排除浏览器不兼容。

2022-08-22 23:13:42 605

原创 Error: Cannot find module ‘@/xxx‘

执行完tsc后,用node运行js发现报错了Error: Cannot find module '@/xxx'原因在tsconfig中配置了paths, 但是typescript 不会对 别名进行额外的转换"paths": { "@/*": ["./src/*"] } 解决使用苦 module-alias在package.json配置跟 webpack alias 的路径指向然后在入口文件调用引用方法即可// Aliases"_moduleAliases": {

2022-03-11 11:23:50 2761 1

原创 (plugin postcss) Error: ‘~/theme/default.less‘ wasn‘t found. Tried - /style/themes 。less 中的~什么意思

适用rollup打包报错,报错信息如下发现是不识别less中的~导致的解决问题import NpmImport from 'less-plugin-npm-import';import postcss from 'rollup-plugin-postcss';export default { ...... plugins: [ postcss({ use: [['less', { plugins: [new NpmImport({prefix: '

2022-03-03 11:12:14 3047 2

原创 c++ ‘-DNODE_GYP_MODULE_NAME=libsass‘ ‘-DUSING_UV_SHARED=1‘ ‘-DUSING_V8_SHARED=1‘ ‘-DV8_DEPRECATION_

yarn add 时报错 c++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS'解决方法node 版本太高,切换到node 14.x. 就可以了参考文档...

2022-02-11 18:02:17 2443

原创 如何关闭eslint相关规则

根目录创建 .eslintrc.jsmodule.exports = { xxx: 'xxx', overrides: [ { files: ['*.ts', '*.tsx'], rules: { '@typescript-eslint/no-namespace': 0, '@typescript-eslint/no-use-before-define': 0, '@typescript-eslint/no-unuse

2022-01-19 17:47:45 984

原创 js 获取伪类和css变量

获取css变量getComputedStyle(document.documentElement) .getPropertyValue('--primary-color'); 获取伪类元素var dom = getComputedStyle(document.body, '::before');

2022-01-04 16:41:07 913

原创 找不到模块“XXX”或其相应的类型声明

最近项目中写了一个组件,通过npm发布, 在业务方中使用中发现, 无法识别我们的组件,和组件对应的类型,打包内容如下查阅了下资料发现是没有配置typing配置一下就可以了!????

2021-12-29 15:44:17 5470 2

原创 antd 日期组件出现了英文

默认不设置语言日期组件组件了英文https://codesandbox.io/s/antd-reproduction-template-zcqjf解决办法import 'moment/dist/locale/zh-cn';参考文档https://github.com/ant-design/ant-design/issues/23891

2021-11-09 16:31:04 1547

原创 This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘

最近支援的小组开发,yarn 后,启动报错,别的小伙伴没有报错原因一node版本和项目版本不对原因二node版本切换之后没有删除node_modules下的.cache文件导致的

2021-11-07 14:01:45 3863

原创 js 数字不足位数补0

方式一,使用padStart'9'.padStart(2,0);// 09方式二,使用Intl.NumberFormatnew Intl.NumberFormat(undefined, { minimumIntegerDigits: 2, useGrouping:false}).format(9);//09

2021-10-28 12:12:02 2148

原创 vite Unrestricted file system access to

报错信息如下Unrestricted file system access to "/node_modules/.vite/chunk-EQBIS5ZW.js"For security concerns, accessing files outside of serving allow list will be restricted by default in the future version of Vite. Refer to https://vitejs.dev/config/#server-f

2021-09-20 10:51:18 1343

原创 算法来为图像找到好的裁剪

算法来为图像找到好的裁剪Smartcrop.js 实现了一种算法来为图像找到好的裁剪。它可以在浏览器中、节点中或通过 CLI 使用。

2021-09-07 19:41:37 186

原创 去除Chrome input 输入框默认背景颜色

input.input:-webkit-autofill { box-shadow: 0 0 0 30px var(--gray) inset !important; } input.input:-webkit-autofill:focus { box-shadow: 0 0 0 1000px var(--gray) inset !important; } input.input:-internal-autofill-previewed, inp..

2021-08-18 17:45:37 738

原创 git pull 报错

当我执行 git pull 报错了原因:远程删除了分支本地也想删除解决办法git remote prune origin

2021-07-09 16:24:13 2565

原创 css鼠标移动上去才显示滚动条

当鼠标移动上去才显示滚动条,用css就可以完成.list { /*默认显示滚动条,设置为白色看不出来*/ overflow: scroll; height: 500px; }.list::-webkit-scrollbar { width: 10px; background-color: #fff;}.list:hover ::-webkit-scrollbar-track-piece { /*鼠标移动上去再显示滚动条*/ background

2021-07-05 17:11:14 8069 1

原创 React 箭头函数组件使用泛型

当使用function使用泛型时,ts不会报错当使用箭头函数使用泛型时,ts会报错出现原因及解决办法在线上编译时可以的因为和 JSX 语法冲突解决办法如下或者 添加 extends

2021-07-05 12:05:17 3719

原创 获取元素准确的offset

通过getBoundingClientRect获取(推荐)const getOffset = (element: HTMLElement) => { const elemRect = element.getBoundingClientRect(); const offsetY = elemRect.top + window.scrollY; const offsetX = elemRect.left + window.scrollX; return {

2021-07-04 15:07:01 409

原创 react 通过 访问最新dom

访问react 最新dom一般情况我们这样即可,这样不能检测dom的挂载和卸载 const textInput = useRef(null);可以使用方法传递给ref const ref = e => { // React 将在组件挂载时,会调用 ref 回调函数并传入 DOM 元素,当卸载时调用它并传入 null dataRef.current.div = e; setMounted(!!e); }; <

2021-06-24 15:54:55 276

原创 为 rc-Form 添加 获取disabled

背景在使用ant表单的时候,当我们需要在校验不通过时,按钮就禁用,但是Form没有给我们提供onDisable的方法,怎么办呢?解决办法通过onValuesChange时进行validate const [disabled, setDisabled] = useState(false);//默认检验不通过 const fieldDisabledRef = useRef({}); const valueChange = changeValue => { if (!for

2021-06-06 14:58:26 363

原创 css 最后一排不添加margin

css 最后一排自定义样式需求:最后一排不需要添加margin可以使用伪类选择器// 最后3个margin-bottom 设置为0span.index__checkbox-3vfpk:nth-last-of-type(-n+3) { margin-bottom: 0; }参考文档https://www.w3school.com.cn/cssref/selector_nth-last-of-type.asphttps://www.thinbug.com/q/26839759...

2021-06-03 15:58:06 1729

原创 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/func

错误代码 if (children) { return React.cloneElement(children, { onClick: handleClick }); }上述代码报错了,错误信息如下Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got:

2021-02-20 14:47:11 2453

原创 获取当前日期的周开始时间周结束时间

原生js获取周的开始时间和结束时间/** * 获取当前日期的周开始时间和周结束时间 * @example * getWeekDate(new Date()) =>{ weekStartDate: new Date(), weekEndDate: new Date() } */export const getWeekDate = (date: Date, format?: (date: Date) => string) => { const nowDayOfWeek =

2021-02-07 20:54:30 576 1

原创 下拉刷新和轮播图冲突解决办法,React版本

背景当头部是轮播图,下边是下拉刷新列表时,在 @1 下拉刷新没有问题,在@2斜线下拉,会触发轮播图和下拉刷新解决思路当手指按下的时候监听按下所在的位置,如果是在下拉刷新容器内,不做任务操作,如果是不在下拉刷新容器内,禁用下拉刷新第一步:封装带有禁用antd的list-viewimport { ListView as AntListView, PullToRefresh } from 'antd-mobile';import { ListViewProps } from 'antd-mobile

2021-01-27 18:52:05 429

原创 将React节点渲染到指定节点

ReactDOM.createPortal( <div className={styles.bg}> <div className={styles.container}> <span onClick={onCancel}> <SvgIcon type="#csg-icon-close" className={styles..

2020-09-20 13:24:45 529

原创 vscode代码片段,react模版

{ // 在此处放置您的片段。 每个代码段均以代码段名称定义,并具有范围,前缀,主体和 // 描述。 在范围字段中添加代码段适用的语言的逗号分隔ID。 如果范围 // 如果保留为空或省略,则代码段将应用于所有语言。 前缀是什么 // 用于触发代码段,然后将展开并插入正文。 可能的变量是: // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placehold

2020-08-09 11:44:19 1110

原创 jsdoc/check-examples 报错

在写ts文档@example时报错错误很明显了,example中的写法不规范这样就可以了,因为 example 里边是代码也要格式化,这点挺好的

2020-07-31 18:35:57 209

原创 toFixed 四舍五入的问题

原生toFixed , 会有四舍五入的问题,所以自己封装一个方法/** *和原生toFixed的区别在于这个没有四舍五入 * @example * toFixed(2.999,1) === '2.9' * @export * @param {(string | number)} target 要转换的字符串或者数字 * @param {number} num 保留多少位小数 * @returns {string} */export function toFixed(target: .

2020-07-20 11:19:27 666

原创 No inputs were found in config file ‘tsconfig.json‘. Specified ‘include‘ paths were

在用ts-loader打包????js的时候出现了这个错错误提示找不到我们对应的文件, 原因是我们使用的是tsconfig却要打包js, 只需要把tsconfig中的 allowJs 改为true就可以了{ "compilerOptions": { "allowJs": true, } }...

2020-07-07 20:01:49 11388 5

原创 lerna 项目 执行 yarn 子项目没有安装 node_modules

在父项目中package.json添加如下"workspaces": { "packages": [ "packages/*", "work/data", ] },在附项目根目录下执行yarn,子项目work/data没有安装依赖原因如下子项目中的package.json没有添加"version": “1.0.0”,添加好之后再执行就可以了{ "private": true, "name":

2020-07-07 18:50:05 3253

原创 webpack 配置 alias

webpack 配置 alias 后很方便,有时有我们项目比较大,比较复杂的时候尤为重要const path = require('path');const resolvePath = relativePath => path.resolve(process.cwd(), relativePath);{....alias: { '@': resolvePath('src'), '@common': '../../common', }, }

2020-07-03 17:16:30 4513

原创 TS 使用React , forwardRef写一个复制文本组件

React.forwardRef 接收一个函数组件useImperativeHandle 返回暴露的ref的具体类型import React, { useRef, useImperativeHandle } from 'react';import ReactDOM from 'react-dom';interface CopyProps { text: string;}interface InputRefProps { copy(): void;}/** * 复制文本input

2020-06-17 20:41:25 3803

原创 React 模拟点击事件

imgRef.current.dispatchEvent(new MouseEvent('mouseout', { bubbles: true }));React模拟点击事件是用的原生模拟, 一定要加上{ bubbles: true }, 冒泡

2020-06-17 11:38:32 4749

原创 linux 无法识别node命令和npm命令

之前安装了node也部署了项目,可是最近去发现,node命令和 npm 命令 不能用了,但是nvm还是能用,百度google了许久尝试了很多都不行比如使用以下也不行解决办法重新使用nvm 指定 node 版本就这样node就又可以使用 了...

2020-05-25 15:10:09 1349

原创 递归Partial类型

/** * 递归Partial类型 */export type PowerPartial<T> = { // 如果是 object,则递归类型 [U in keyof T]?: T[U] extends object ? PowerPartial<T[U]> : T[U];};

2020-05-19 10:50:58 433

原创 js 解决精度问题

js 解决精度问题4.1*100 // 409.99999999999994解决办法:parseFloat((4.1*100).toPrecision(12)) // 410toPrecision ()https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/toPr...

2020-04-29 21:59:42 398

原创 git 不使用.gitignore 忽略某个文件

在git项目中 .git/info/exclude 这个文件里使用方式和 .gitignore 一样

2020-04-28 13:57:15 551

原创 uncaught at _callee3 at _callee3

在使用dva+ react的时候出现 uncaught at _callee3 at _callee3原因在dva的model中有异常抛出,或者报错了,没有处理解决在创建 dva的时候添加 onError 即可

2020-04-24 18:37:32 7983 5

原创 scope may not be empty [scope-empty]

git commit 提价报这个错✖ scope may not be empty [scope-empty]git commit -am 'feat: 提交内容'这个错误很明显了,没有添加范围,应为用到了lerna 管理父子项目加上范围就可以了git commit -am 'feat(modeA): 提交内容'最后根据这个地址找到了答案...

2020-04-03 00:56:55 2613

省市区三级联动tree数据,json

{ "id": 110000, "label": "北京市", "value": "北京市", "parentId": 100000, "levelType": 1, "children": [ { "id": 110100, "label": "北京城区", "value": "北京城区", "parentId": 110000, "levelType": 2, "children": [ {...} ] } ] }

2023-02-15

rootCA.crt。https代理协议

https代理协议

2021-08-02

rainbow-fart-1.1.0.vsix

VSCode Rainbow Fart 是一个在你编程时持续夸你写的牛逼的扩展,可以根据代码关键字播放贴近代码意义的真人语音。

2020-06-18

auto.pac deepin 在线pac文件,拿来即用,不用自己配置和下载

deepin 在线pac文件,拿来即用,不用自己配置和下载 安装pip后安装genpac: sudo apt install python3-pip sudo pip3 install genpac 生成pac文件: genpac --pac-compress --pac-proxy 'SOCKS5 127.0.0.1:1080' --format pac -o ~/auto.pac

2019-12-22

Allow-Control-Allow-Origin.rar

Allow-Control-Allow-Origin google 解决跨域插件

2019-09-05

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除