wip: refactor layout

This commit is contained in:
vben
2020-11-23 23:24:13 +08:00
parent 234c1d1fae
commit ba068ba1df
79 changed files with 1393 additions and 1196 deletions

View File

@@ -1,3 +1,4 @@
import { openWindow } from '..';
import { dataURLtoBlob, urlToBase64 } from './base64Conver';
/**
@@ -93,6 +94,6 @@ export function downloadByUrl({
url += '?download';
}
window.open(url, target);
openWindow(url, { target });
return true;
}

View File

@@ -1,5 +1,5 @@
import { getEnv } from '/@/utils/env';
import { useGlobSetting } from '/@/settings/use';
import { useGlobSetting } from '/@/hooks/setting';
import pkg from '../../../package.json';
const globSetting = useGlobSetting();

View File

@@ -10,7 +10,7 @@ import { AxiosTransform } from './axiosTransform';
import { checkStatus } from './checkStatus';
import { useGlobSetting } from '/@/settings/use';
import { useGlobSetting } from '/@/hooks/setting';
import { useMessage } from '/@/hooks/web/useMessage';
import { RequestEnum, ResultEnum, ContentTypeEnum } from '/@/enums/httpEnum';

View File

@@ -11,6 +11,7 @@ export function getPopupContainer(node?: HTMLElement): HTMLElement {
}
return document.body;
}
/**
* Add the object as a parameter to the URL
* @param baseUrl url
@@ -64,3 +65,16 @@ export function unique<T = any>(arr: T[], key: string): T[] {
export function es6Unique<T>(arr: T[]): T[] {
return Array.from(new Set(arr));
}
export function openWindow(
url: string,
opt?: { target?: TargetContext | string; noopener?: boolean; noreferrer?: boolean }
) {
const { target = '__blank', noopener = true, noreferrer = true } = opt || {};
const feature: string[] = [];
noopener && feature.push('noopener=yes');
noreferrer && feature.push('noreferrer=yes');
window.open(url, target, feature.join(','));
}