feat: upload, edit & delete file, folder

This commit is contained in:
Methapon2001 2023-11-28 16:30:48 +07:00
parent 046b915fc3
commit 9e889ccaa1
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
6 changed files with 583 additions and 227 deletions

View file

@ -1,27 +1,14 @@
<script setup lang="ts">
import { useTreeDataStore } from '@/stores/tree-data'
const { deleteFolder } = useTreeDataStore()
const emit = defineEmits(['update:confirmDelete'])
const props = withDefaults(
defineProps<{ confirmDelete: boolean; pathname: string }>(),
{
confirmDelete: false,
}
)
defineEmits(['confirm', 'cancel'])
</script>
<template>
<q-dialog
v-model="props.confirmDelete"
persistent
transition-show="scale"
transition-hide="scale"
>
<q-dialog persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 400px">
<q-card-section>
<div class="text-h6"><q-icon name="error" color="negative" size="2.5rem"/>แจงเตอนการลบ</div>
<span class="text-h6">
<q-icon name="error" color="negative" size="2.5rem" />แจงเตอนการลบ
</span>
</q-card-section>
<q-card-section class="q-pt-none">
@ -31,58 +18,20 @@ const props = withDefaults(
<q-card-actions align="right" class="bg-white text-primary">
<q-space />
<q-btn
flat
label="ยกเลิก"
flat
v-close-popup
@click="
() => {
emit('update:confirmDelete')
}
"
@click="() => $emit('cancel')"
/>
<q-btn
flat
label="ลบ"
v-close-popup
label="ลบ"
class="text-red"
@click="
() => {
deleteFolder(pathname)
emit('update:confirmDelete')
}
"
@click="() => $emit('confirm')"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style lang="scss" scoped>
.box {
display: inline-block;
border: 2px solid #f1f2f4;
border-radius: 8px;
cursor: pointer;
}
.dashed {
opacity: 0.4;
display: inline-block;
border: 2px solid #babdc3;
border-radius: 8px;
cursor: pointer;
border-style: dashed;
}
.add-icon {
margin: auto auto;
}
.add-button {
position: absolute;
top: 75px;
right: 45px;
background-color: white;
}
</style>