This commit is contained in:
syuilo 2020-09-20 21:37:09 +09:00
parent ea37ff3b61
commit bf3ed2a1f0
2 changed files with 23 additions and 9 deletions

View File

@ -38,6 +38,16 @@
<mfm :text="mfm"/>
</div>
</div>
<div class="_card _vMargin">
<div class="_title">selectDriveFile</div>
<div class="_content">
<mk-button @click="selectDriveFile()">selectDriveFile</mk-button>
</div>
<div class="_content">
</div>
</div>
</div>
</template>
@ -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();
}
}
});

View File

@ -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]);
});
});
}