04 2020 档案
摘要:1.常用轮子分析 react-live-route -- 重写可以实现我们想要的功能,但成本也比较高,需要注意对原始 <Route> 功能的保存,以及多个 react-router 版本的兼容 185 react-keeper -- 完全替换掉路由方案是一个风险较大的事情,需要较为慎重地考虑 716
阅读全文
摘要:逻辑组织中,待完成。。。
阅读全文
摘要:逻辑组织中,待完成。。。
阅读全文
摘要:1.代码如下: src/utils/request.js /** * 请求方法封装 */ import Taro from '@tarojs/taro' import { API_USER, API_USER_LOGIN } from '@constants/api' const CODE_SUCC
阅读全文
摘要:1.适当封装 Redux,简化调用 src/utils/redux.js /** * 适当封装 Redux,简化调用 */ /* eslint-disable import/prefer-default-export */ import fetch from './request' export f
阅读全文
摘要:1.封装工具类 utils/jump.js import Taro from '@tarojs/taro' const PAGE_WEBVIEW = '/pages/webview/webview' /** * // NOTE 后端返回的 url 可能是网页链接,需要在 webview 中打开 *
阅读全文
摘要:1.封装工具类 src/utils/style.js import Taro from '@tarojs/taro' const NAVIGATOR_HEIGHT = 44 const TAB_BAR_HEIGHT = 50 /** * 返回屏幕可用高度 * // NOTE 各端返回的 window
阅读全文
摘要:1.配置 config/index.js const config = { ... h5: { // NOTE H5 打包静态资源时带 hash 值,方便缓存、版本管理 publicPath: '/', staticDirectory: 'static', output: { filename: '
阅读全文
摘要:1.配置 config/index.js const path = require('path') ... const config = { alias: { '@actions': path.resolve(__dirname, '..', 'src/actions'), '@assets': p
阅读全文
摘要:1.在 sass 中通过别名(@ 或 ~)引用需要指定路径 config/index.js const path = require('path') // NOTE 在 sass 中通过别名(@ 或 ~)引用需要指定路径 const sassImporter = function(url) { if
阅读全文
摘要:1.src/app.js tabBar: { color: "#666", selectedColor: "#b4282d", backgroundColor: "#fafafa", borderStyle: 'black', list: [{ pagePath: "pages/home/home"
阅读全文
摘要:1.安装 cross-env yarn add cross-env -D 2.配置 dev.js config/dev.js // NOTE H5 端使用 devServer 实现跨域,需要修改 package.json 的运行命令,加入环境变量 const isH5 = process.env.C
阅读全文
摘要:数据迁移比较简单,单击工具选择数据传输 左边是旧服务器,右边是新服务器。在新服务器内建相同名字的数据库。然后左右同时选择,点下一步,再点击同步就好了。等待数据完成。
阅读全文
摘要:步骤一:转储 SQL 文件 1.右击要被导出的数据库,点击“转储SQL文件”,修改文件名和文件位置后点击保存,等待程序执行。 2.执行完成后无错误点击关闭即完成了SQL文件的导出 步骤二:新建数据库 步骤三:运行SQL 文件 1.将sql文件拖到该数据库上,会出现“运行SQL文件”窗口,点击开始。执
阅读全文
摘要:1.方法一: // ES6对象数组所有属性去重,筛选每个数组项的字符 function unique(arr) { const map = new Map() return arr.filter( item => !map.has(JSON.stringify(item)) && map.set(J
阅读全文
摘要:1.情况一 componentWillUpdate 2.情况二: componentDidUpdate 3.情况三: render
阅读全文
摘要:1.报错信息: Ignoring invalid timezone passed to Connection: +8:00. This is currently a warning, but in future versions of MySQL2, an error will be thrown
阅读全文
摘要:项目中,上传图片是通过 stream,上传excel是通过 file 接收的 config.multipart = { // fileSize: '50mb', // 文件大小 fileModeMatch: /^(\/tools\/excel\/import)$/, // '/tools/excel
阅读全文
摘要:1.代码 chatbot/index.tsx /** * 客服 */ import React, { useState, useRef } from 'react'; import { Button, Toast, InputItem } from 'antd-mobile'; import { R
阅读全文
摘要:为了保证文件上传的安全,框架限制了支持的的文件格式,框架默认支持白名单如下: // images '.jpg', '.jpeg', // image/jpeg '.png', // image/png, image/x-png '.gif', // image/gif '.bmp', // imag
阅读全文
摘要:input file上传按钮的美化思路是,先把之前的按钮透明度opacity设置为0,然后,外层用div包裹,就实现了美化功能。 1.html <div className="file"> <input type="file" onChange={(e)=>{this.onChange(e)}} c
阅读全文
摘要:1.安装模块 yarn add react-lazyload 2.使用 import LazyLoad from 'react-lazyload'; ... <Grid data={categoryList} columnNum={2} square={false} hasLine={false}
阅读全文
摘要:1.代码 function App () { const [ count, setCount ] = useState(0) const [ width, setWidth ] = useState(document.body.clientWidth) const onChange = () =>
阅读全文