样式适配
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { getUniversalZoomLevel } from "@/tool/util";
|
||||
|
||||
let flexible = (designWidth, maxWidth,minWidth) =>{
|
||||
var doc = document, win = window, docEl = doc.documentElement, remStyle = document.createElement("style"), tid;
|
||||
designWidth = designWidth || 1920;
|
||||
maxWidth = maxWidth || 2560;
|
||||
minWidth = minWidth || 1024;
|
||||
minWidth = minWidth || 500;
|
||||
// minWidth = minWidth || 1024;
|
||||
function refreshRem() {
|
||||
var width = docEl.getBoundingClientRect().width;
|
||||
var height = docEl.getBoundingClientRect().height;
|
||||
width = getUniversalZoomLevel() * width
|
||||
height = getUniversalZoomLevel() * height
|
||||
maxWidth = maxWidth || 1920;
|
||||
if(width/height>1.98) width = height * 1.98;
|
||||
width > maxWidth && (width = maxWidth);
|
||||
|
||||
@@ -5,7 +5,18 @@ const isEmail = (email) => {
|
||||
let result = reg.test(email)
|
||||
return result
|
||||
}
|
||||
|
||||
function getUniversalZoomLevel() {
|
||||
// 现代浏览器方案
|
||||
if (window.visualViewport) {
|
||||
return window.visualViewport.scale;
|
||||
}
|
||||
// 备用方案1
|
||||
if (window.devicePixelRatio) {
|
||||
return window.devicePixelRatio;
|
||||
}
|
||||
// 备用方案2(不精确)
|
||||
return window.outerWidth / window.innerWidth;
|
||||
}
|
||||
const getUploadUrl = () => {
|
||||
let url = process.env.VUE_APP_BASE_URL || ''
|
||||
// let url = "http://18.167.251.121:10086"
|
||||
@@ -569,6 +580,7 @@ function segmentImage(markerImage,fullImage,size){
|
||||
export {
|
||||
isEmail,
|
||||
getUploadUrl,
|
||||
getUniversalZoomLevel,
|
||||
rgbaToHex,
|
||||
getMinioUrl,
|
||||
base64ToFile,
|
||||
|
||||
Reference in New Issue
Block a user