diff --git a/src/client/pages/test.vue b/src/client/pages/test.vue index 16ff5aa135..d11cdef8d0 100644 --- a/src/client/pages/test.vue +++ b/src/client/pages/test.vue @@ -38,6 +38,16 @@ + +
+
selectDriveFile
+
+ selectDriveFile +
+
+ +
+
@@ -48,6 +58,7 @@ import MkButton from '@/components/ui/button.vue'; import MkInput from '@/components/ui/input.vue'; import MkSwitch from '@/components/ui/switch.vue'; import MkTextarea from '@/components/ui/textarea.vue'; +import { selectDriveFile } from '@/scripts/select-drive-file'; import * as os from '@/os'; export default defineComponent({ @@ -87,6 +98,10 @@ export default defineComponent({ cancelableByBgClick: this.dialogCancelByBgClick, input: this.dialogInput ? {} : null }); + }, + + async selectDriveFile() { + const files = await selectDriveFile(); } } }); diff --git a/src/client/scripts/select-drive-file.ts b/src/client/scripts/select-drive-file.ts index 6a2d531cc4..cd3a3082c9 100644 --- a/src/client/scripts/select-drive-file.ts +++ b/src/client/scripts/select-drive-file.ts @@ -1,13 +1,12 @@ +import * as os from '@/os'; + export function selectDriveFile(multiple) { - return new Promise((res, rej) => { - import('@/components/drive-window.vue').then(dialog => { - const w = $root.new(dialog, { - type: 'file', - multiple - }); - w.$once('selected', files => { - res(multiple ? files : files[0]); - }); + return new Promise(async (res, rej) => { + os.modal(await import('@/components/drive-window.vue'), { + type: 'file', + multiple + }).then(files => { + res(multiple ? files : files[0]); }); }); }