File tree Expand file tree Collapse file tree 6 files changed +200
-14
lines changed Expand file tree Collapse file tree 6 files changed +200
-14
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ declare module '@vue/runtime-core' {
7
7
export interface GlobalComponents {
8
8
AppButton : typeof import ( './src/components/AppButton.vue' ) [ 'default' ]
9
9
AppImage : typeof import ( './src/components/AppImage.vue' ) [ 'default' ]
10
+ AppImageDropzone : typeof import ( './src/components/AppImageDropzone.vue' ) [ 'default' ]
10
11
BoardCard : typeof import ( './src/components/BoardCard.vue' ) [ 'default' ]
11
12
RouterLink : typeof import ( 'vue-router' ) [ 'RouterLink' ]
12
13
RouterView : typeof import ( 'vue-router' ) [ 'RouterView' ]
Original file line number Diff line number Diff line change 14
14
},
15
15
"dependencies" : {
16
16
"@vue/apollo-composable" : " ^4.0.0-alpha.18" ,
17
+ "@vueuse/core" : " ^8.9.2" ,
17
18
"graphql-tag" : " ^2.12.6" ,
18
19
"lodash-es" : " ^4.17.21" ,
19
20
"unplugin-vue-components" : " ^0.20.1" ,
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import { useBase64 , useDropZone } from " @vueuse/core" ;
3
+ import { ref } from " vue" ;
4
+
5
+ const dropzoneEl = ref <HTMLElement | null >(null );
6
+ const file = ref ();
7
+ const { base64 : url } = useBase64 (file );
8
+ const { isOverDropZone } = useDropZone (dropzoneEl , (files ) => {
9
+ if (! files ) return ;
10
+ file .value = files [0 ];
11
+ console .log (file .value );
12
+ });
13
+
14
+ function onFileChange(e : any ) {
15
+ file .value = e .target .files [0 ];
16
+ console .log (file .value );
17
+ }
18
+
19
+ function reset() {
20
+ file .value = null ;
21
+ }
22
+ </script >
23
+
24
+ <template >
25
+ <div
26
+ ref =" dropzoneEl"
27
+ class =" flex m-4"
28
+ :class =" {
29
+ border: isOverDropZone,
30
+ 'bg-orange-100': isOverDropZone,
31
+ 'border-orange-400': isOverDropZone,
32
+ }"
33
+ style =" width : 300px ; height : 200px ; background : #3332 ; position : relative "
34
+ >
35
+ <div class =" m-auto opacity-50" >Drop a image over or select</div >
36
+ <div v-if =" url" class =" absolute left-0 top-0 bottom-0 right-0 object-cover" >
37
+ <img :src =" url" class =" h-full" />
38
+ </div >
39
+ <input
40
+ class =" absolute z-1 left-0 top-0 bottom-0 right-0 opacity-0"
41
+ type =" file"
42
+ accept =" image/*"
43
+ @input =" onFileChange"
44
+ />
45
+ </div >
46
+ <button @click =" reset" >Reset</button >
47
+ </template >
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
-
3
2
import { Drawer , DrawerContent } from " @progress/kendo-vue-layout" ;
4
-
3
+ import { useLocalStorage } from " @vueuse/core " ;
5
4
import { useRouter } from " vue-router" ;
6
5
7
6
import { computed , ref } from " vue" ;
8
7
9
- // const router = useRouter();
8
+ // const router = useRouter();
10
9
const selectedId = ref (0 );
11
10
12
- const expanded = ref ( false );
11
+ const expanded = useLocalStorage ( " vue-forge-drawer-expanded " , true );
13
12
const expandedIcon = computed (() =>
14
13
expanded .value ? " k-i-arrow-chevron-left" : " k-i-arrow-chevron-right"
15
14
);
@@ -50,16 +49,22 @@ function onSelect({ itemIndex }: { itemIndex: number }) {
50
49
if (item .data .path ) router .push (item .data .path );
51
50
if (typeof item .data .action === " function" ) item .data .action ();
52
51
}
53
-
54
52
</script >
55
53
56
54
<template >
57
- <Drawer class =" h-[90vh]" :expanded =" expanded" position =" start" mode =" push" :mini =" true" :items =" items"
58
- @select =" onSelect" >
59
- <DrawerContent >
60
- <div class =" px-5" >
61
- <router-view />
62
- </div >
63
- </DrawerContent >
64
- </Drawer >
65
- </template >
55
+ <Drawer
56
+ class =" h-[90vh]"
57
+ :expanded =" expanded"
58
+ position =" start"
59
+ mode =" push"
60
+ :mini =" true"
61
+ :items =" items"
62
+ @select =" onSelect"
63
+ >
64
+ <DrawerContent >
65
+ <div class =" px-5" >
66
+ <router-view />
67
+ </div >
68
+ </DrawerContent >
69
+ </Drawer >
70
+ </template >
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import AppImageDropzone from " ../../components/AppImageDropzone.vue" ;
3
+ </script >
4
+
5
+ <template >
6
+ <AppImageDropzone />
7
+ </template >
You can’t perform that action at this time.
0 commit comments