fix download name

This commit is contained in:
Theluyuan 2023-05-05 09:54:52 +08:00
parent f2249478ed
commit 27f75e2ced
4 changed files with 11 additions and 7 deletions

View File

@ -950,7 +950,8 @@ const _sfc_main = defineComponent({
getCheckboxProps: { type: Function, default: () => { getCheckboxProps: { type: Function, default: () => {
} }, } },
getRadioProps: { type: Function, default: () => { getRadioProps: { type: Function, default: () => {
} } } },
download: { default: "" }
}, },
emits: [ emits: [
"change", "change",
@ -1185,7 +1186,7 @@ const _sfc_main = defineComponent({
</html>`; </html>`;
let a = document.createElement("a"); let a = document.createElement("a");
a.href = uri + base64(exportTemplate); a.href = uri + base64(exportTemplate);
a.download = "\u4E0B\u8F7D\u6587\u4EF6.xls"; a.download = (props.download || "\u4E0B\u8F7D\u6587\u4EF6") + ".xls";
a.click(); a.click();
return; return;
}; };

View File

@ -19374,7 +19374,8 @@ const _sfc_main$D = defineComponent({
getCheckboxProps: { type: Function, default: () => { getCheckboxProps: { type: Function, default: () => {
} }, } },
getRadioProps: { type: Function, default: () => { getRadioProps: { type: Function, default: () => {
} } } },
download: { default: "" }
}, },
emits: [ emits: [
"change", "change",
@ -19609,7 +19610,7 @@ const _sfc_main$D = defineComponent({
</html>`; </html>`;
let a = document.createElement("a"); let a = document.createElement("a");
a.href = uri + base64(exportTemplate); a.href = uri + base64(exportTemplate);
a.download = "\u4E0B\u8F7D\u6587\u4EF6.xls"; a.download = (props.download || "\u4E0B\u8F7D\u6587\u4EF6") + ".xls";
a.click(); a.click();
return; return;
}; };

View File

@ -52,6 +52,7 @@ export interface TableProps {
loading?: boolean; loading?: boolean;
getCheckboxProps?: Function; getCheckboxProps?: Function;
getRadioProps?: Function; getRadioProps?: Function;
download?:string;
} }
const props = withDefaults(defineProps<TableProps>(), { const props = withDefaults(defineProps<TableProps>(), {
@ -76,6 +77,7 @@ const props = withDefaults(defineProps<TableProps>(), {
loading: false, loading: false,
getCheckboxProps: () => {}, getCheckboxProps: () => {},
getRadioProps: () => {}, getRadioProps: () => {},
download:""
}); });
const emit = defineEmits([ const emit = defineEmits([
@ -423,7 +425,7 @@ const exportData = () => {
</html>`; </html>`;
let a = document.createElement("a") let a = document.createElement("a")
a.href = uri + base64(exportTemplate); a.href = uri + base64(exportTemplate);
a.download="下载文件.xls"; a.download= (props.download || "下载文件") + ".xls";
a.click(); a.click();
// window.location.href = // window.location.href =
return; return;

File diff suppressed because one or more lines are too long