fix: remote update failed and template not found

This commit is contained in:
2025-05-15 20:23:48 +08:00
parent 00ce79fa7b
commit 1eded97c76
11 changed files with 394 additions and 296 deletions

View File

@@ -6,7 +6,12 @@
<!-- Input File -->
<fieldset class="fieldset w-full">
<legend class="fieldset-legend text-sm">选择或拖拽上传文件</legend>
<input type="file" class="file-input w-full" :value="fileInput" @change="handleFileChange" />
<input
type="file"
ref="fileInput"
class="file-input w-full"
@change="handleFileChange"
/>
<label class="fieldset-label">文件最大容量: {{ maxMemory }}MB</label>
</fieldset>
@@ -20,8 +25,7 @@
</template>
<script lang="ts" setup>
import { computed, ref } from "vue";
import { useEquipments } from "@/stores/equipments";
import { computed, useTemplateRef, onMounted } from "vue";
import { useDialogStore } from "@/stores/dialog";
import { isNull, isUndefined } from "lodash";
@@ -41,16 +45,19 @@ const emits = defineEmits<{
}>();
const dialog = useDialogStore();
const eqps = useEquipments();
const buttonText = computed(() => {
return isUndefined(props.downloadEvent) ? "上传" : "上传并下载";
});
// var bitstream: File | null = null;
const fileInput = useTemplateRef("fileInput");
const bitstream = defineModel<File | undefined>();
const fileInput = computed(() => {
return !isUndefined(bitstream.value) ? bitstream.value.name : "";
onMounted(() => {
if (!isUndefined(bitstream.value) && !isNull(fileInput.value)) {
let fileList = new DataTransfer();
fileList.items.add(bitstream.value);
fileInput.value.files = fileList.files;
}
});
function handleFileChange(event: Event): void {
@@ -111,7 +118,6 @@ async function handleClick(event: Event): Promise<void> {
console.error(e);
}
}
</script>
<style scoped lang="postcss">