12 2022 档案
摘要:字符串换行 方式一:\n换行 <div style={{whiteSpace: 'pre-wrap'}}> { "1\n2 } </div> 输出结果: 1 2 方式二:模板字符串换行 <div style={{whiteSpace: 'pre-wrap'}}> { `1 2` } </div> 输
阅读全文
摘要:对象转query串 本质是: new URLSearchParams(Object.entries(newObj)).toString() 整合后去除params的空值后,如下: /** * @description: 对象转query串 * @param {*} obj * @param {*}
阅读全文
摘要:export const filterParams = (obj) => { let newObj = {}; for (const key in obj) { //如果对象属性的值不为空,就保存该属性(如果属性的值为0 false,保存该属性。如果属性的值全部是空格,属于为空。) if ((obj
阅读全文
摘要:实现了pdf翻页,放大,缩小,全屏展示,右键打印。 实现代码: js: import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { Spin, Tooltip, In
阅读全文
摘要:var playerVideo = videojs("my-player", options, function onPlayerReady() { videojs.log('Your player is ready!'); this.on("loadstart",function(){ conso
阅读全文
摘要:<Form.Item label="学生编码" name="stuId" validateFirst={true} // 出错时两个校验分别生效 rules={[ { required: true, message: '学生编码不能为空' }, { validator: (rule, value)
阅读全文
摘要:在使用npm 安装依赖时,执行到 Missing binding E:\webstorm\notepad\notepad\node_modules\node-sass\vendor\win32-x64-46\binding.node Node Sass could not find a bindin
阅读全文
摘要:##问题描述 我正在使用React, react-tiga-swiper做轮播(此处也可替换为其他的轮播组件,解决方案同理),antd的 Image.PreviewGroup做预览。我正在尝试创建一个包含卡片列表的页面。在每张卡片中,都有一个图像轮播。我希望当用户单击图像时,预览会打开,他们可以滑动
阅读全文
摘要:##为什么要改node_modules? 在平常的开发中,其实是很少需要改 node_modules 里的代码的。但是如果npm包有点小问题或者不符合我们的场景。 那我应该怎么改才能是最好的呢? ##方法一:直接改 这种很好懂,就是直接进 node_modules 中,找到那个包的代码,并修改对应的
阅读全文
摘要:在react native中刷新页面就是改变页面的数据源,如果页面的数据源是state或者是store那么当数据源改变了。页面就会自动刷新的。所以刷新页面的两种方式 1:用redux来做数据源,无论在哪个页面只要改变了某一个页面的数据源,那么那个页面都会刷新 2:用回调的方法来刷新前一个页面,在用r
阅读全文
摘要:代码实现: const transSliceImg = (imgs, num) => { let newImgs = [] return imgs.reduce(function(pre,item,index,imgs){ var begin =index*num; var end =begin+n
阅读全文

浙公网安备 33010602011771号