mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 14:31:41 +08:00
wip: refactor layout
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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';
|
||||
|
@@ -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(','));
|
||||
}
|
||||
|
Reference in New Issue
Block a user