chore: fix type

This commit is contained in:
vben 2021-10-26 01:19:51 +08:00
parent ed40b333f3
commit a248e20013
9 changed files with 23 additions and 24 deletions

View File

@ -1,10 +1,10 @@
<template> <template>
<div class="p-2"> <div class="p-2">
<div class="bg-white mb-2 p-4"> <div class="p-4 mb-2 bg-white">
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
</div> </div>
{{ sliderProp.width }} {{ sliderProp.width }}
<div class="bg-white p-2"> <div class="p-2 bg-white">
<List <List
:grid="{ gutter: 5, xs: 1, sm: 2, md: 4, lg: 4, xl: 6, xxl: grid }" :grid="{ gutter: 5, xs: 1, sm: 2, md: 4, lg: 4, xl: 6, xxl: grid }"
:data-source="data" :data-source="data"
@ -167,7 +167,7 @@
pageSize.value = pz; pageSize.value = pz;
fetch(); fetch();
} }
function pageSizeChange(current, size) { function pageSizeChange(_current, size) {
pageSize.value = size; pageSize.value = size;
fetch(); fetch();
} }

View File

@ -242,7 +242,7 @@ export function useFormEvents({
const values = await validate(); const values = await validate();
const res = handleFormValues(values); const res = handleFormValues(values);
emit('submit', res); emit('submit', res);
} catch (error) { } catch (error: any) {
throw new Error(error); throw new Error(error);
} }
} }

View File

@ -265,7 +265,7 @@
result = await beforeEditSubmit({ result = await beforeEditSubmit({
record: pick(record, keys), record: pick(record, keys),
index, index,
key, key: key as string,
value, value,
}); });
} catch (e) { } catch (e) {

View File

@ -408,7 +408,7 @@
<span class={unref(getBindValues)?.blockNode ? `${prefixCls}__content` : ''}> <span class={unref(getBindValues)?.blockNode ? `${prefixCls}__content` : ''}>
<span>{title.substr(0, searchIdx)}</span> <span>{title.substr(0, searchIdx)}</span>
<span style={highlightStyle}>{searchText}</span> <span style={highlightStyle}>{searchText}</span>
<span>{title.substr(searchIdx + searchText.length)}</span> <span>{title.substr(searchIdx + (searchText as string).length)}</span>
</span> </span>
) : ( ) : (
title title

View File

@ -51,7 +51,7 @@ export function copyTextToClipboard(input: string, { target = document.body }: O
let isSuccess = false; let isSuccess = false;
try { try {
isSuccess = document.execCommand('copy'); isSuccess = document.execCommand('copy');
} catch (e) { } catch (e: any) {
throw new Error(e); throw new Error(e);
} }

View File

@ -65,7 +65,7 @@
updateColorWeak(colorWeak); updateColorWeak(colorWeak);
updateGrayMode(grayMode); updateGrayMode(grayMode);
createMessage.success(t('layout.setting.resetSuccess')); createMessage.success(t('layout.setting.resetSuccess'));
} catch (error) { } catch (error: any) {
createMessage.error(error); createMessage.error(error);
} }
} }

View File

@ -36,22 +36,19 @@ export function downloadByBase64(buf: string, filename: string, mime?: string, b
export function downloadByData(data: BlobPart, filename: string, mime?: string, bom?: BlobPart) { export function downloadByData(data: BlobPart, filename: string, mime?: string, bom?: BlobPart) {
const blobData = typeof bom !== 'undefined' ? [bom, data] : [data]; const blobData = typeof bom !== 'undefined' ? [bom, data] : [data];
const blob = new Blob(blobData, { type: mime || 'application/octet-stream' }); const blob = new Blob(blobData, { type: mime || 'application/octet-stream' });
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(blob, filename); const blobURL = window.URL.createObjectURL(blob);
} else { const tempLink = document.createElement('a');
const blobURL = window.URL.createObjectURL(blob); tempLink.style.display = 'none';
const tempLink = document.createElement('a'); tempLink.href = blobURL;
tempLink.style.display = 'none'; tempLink.setAttribute('download', filename);
tempLink.href = blobURL; if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('download', filename); tempLink.setAttribute('target', '_blank');
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank');
}
document.body.appendChild(tempLink);
tempLink.click();
document.body.removeChild(tempLink);
window.URL.revokeObjectURL(blobURL);
} }
document.body.appendChild(tempLink);
tempLink.click();
document.body.removeChild(tempLink);
window.URL.revokeObjectURL(blobURL);
} }
/** /**

View File

@ -81,6 +81,7 @@ export class VAxios {
this.axiosInstance.interceptors.request.use((config: AxiosRequestConfig) => { this.axiosInstance.interceptors.request.use((config: AxiosRequestConfig) => {
// If cancel repeat request is turned on, then cancel repeat request is prohibited // If cancel repeat request is turned on, then cancel repeat request is prohibited
const { const {
// @ts-ignore
headers: { ignoreCancelToken }, headers: { ignoreCancelToken },
} = config; } = config;
@ -149,6 +150,7 @@ export class VAxios {
data: formData, data: formData,
headers: { headers: {
'Content-type': ContentTypeEnum.FORM_DATA, 'Content-type': ContentTypeEnum.FORM_DATA,
// @ts-ignore
ignoreCancelToken: true, ignoreCancelToken: true,
}, },
}); });

View File

@ -35,7 +35,7 @@ export function formatRequestDate(params: Recordable) {
if (value) { if (value) {
try { try {
params[key] = isString(value) ? value.trim() : value; params[key] = isString(value) ? value.trim() : value;
} catch (error) { } catch (error: any) {
throw new Error(error); throw new Error(error);
} }
} }