export default function () {
let ua = {}, agent = navigator.userAgent, m;
ua.iPod = agent.indexOf("iPod") > -1;
ua.iPad = agent.indexOf("iPad") > -1;
ua.iPhone = agent.indexOf("iPhone") > -1;
agent.indexOf("Android") > -1 && (ua.android = parseFloat(agent.slice(agent.indexOf("Android") + 8)));
if (ua.iPad || ua.iPhone || ua.iPod) {
m = /OS (\d+)_/.exec(agent);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- 禁止缩放 --> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| len: 长度 | |
| radix: | |
| */ | |
| export default function (len, radix) { | |
| let CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""); | |
| let chars = CHARS, uuid = [], i; | |
| radix = radix || chars.length; | |
| if (len) { |
URL 的操作,也可以使用第三库 querystring
export default function (name, url) {
let src = url || window.location.href;
if (name && src) {
var r = new RegExp("(\\?|#|&|^)" + name + "=([^&^#]*)(#|&|$)");
var m = src.match(r);material-ui 组件库的消息通知组件的封装,可以在任何地方调用 参考
思路:snackbar 以组件的形式注册后,子自己通过props调用,这里暴露出组件的 ref 从而使用 props 触发
import { useSnackbar, VariantType, WithSnackbarProps } from 'notistack'
import React from 'react'
interface IProps {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 处理 ios 上输入完页面没有恢复到底部到问题 | |
| function fixIOSInput() { | |
| setTimeout(function () { | |
| var tagName = document.activeElement.tagName.toLowerCase() | |
| if (tagName !== 'input' || tagName !== 'textarea') { | |
| window.document.documentElement.scrollTop = window.document.body.scrollHeight; | |
| } | |
| }, 0) | |
| } |
实现原理:textarea本身并不会随着文本高度而增高。给textarea套上外容器,使用绝对定位,设置height:100%; width:100%; 这样textarea就可以随着外容器的高度变化而变化。再利用块级元素填充文字,块元素可以随着文本高度自动增高。设置块元素visibility: hidden;样式与textarea一致即可。 https://juejin.im/post/6844903682266529805
<Container>
<div className='text'>
<div className='hidden'>{decodeText}</div>
<Input
className='textarea'
disabledRepository 联查不支持 where,限制很多,使用 querybuild 和 leftJoinAndMapOne 方法可以将管理表作为一个属性
@Entity("record", { schema: "demo" })
export class Record {
...
question: Question // 定义管理表挂载的属性
}