🆕 添加环境判断, 修复issue#119

This commit is contained in:
xujiang 2021-09-02 19:52:38 +08:00
parent 7333032f63
commit bb2c1b0b42
2 changed files with 16 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { Button } from 'zarm';
import BaseForm from './BaseForm';
import styles from './index.less';
import { IFormConfig } from './schema';
import { IsPC } from '@/utils/tool';
import logo from '@/assets/form.png';
const FormComponent = (props: IFormConfig & { isTpl: boolean }) => {
const {
@ -52,7 +53,7 @@ const FormComponent = (props: IFormConfig & { isTpl: boolean }) => {
backgroundColor: bgColor,
overflow: 'hidden',
position: 'absolute',
pointerEvents: isEditorPage ? 'none' : 'initial',
pointerEvents: isEditorPage || IsPC() ? 'none' : 'initial',
}}
>
{title && (

View File

@ -154,3 +154,17 @@ export const _gaw = (w: number) => {
const vw = window.innerWidth > 800 ? 375 : window.innerWidth;
return (vw / 375) * w;
};
// 代码运行环境判断
export function IsPC() {
var userAgentInfo = navigator.userAgent;
var Agents = new Array('Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod');
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}