アバターファイル選択でimage以外は表示しないように (#5098)

This commit is contained in:
MeiMei 2019-07-04 14:31:30 +09:00 committed by syuilo
parent 5e7a4e4752
commit 97002400a8
6 changed files with 18 additions and 1 deletions

View File

@ -91,6 +91,7 @@ export default ($root: any) => {
? Promise.resolve(file)
: $root.$chooseDriveFile({
multiple: false,
type: 'image/*',
title: locale['desktop']['choose-avatar']
});

View File

@ -91,6 +91,7 @@ export default ($root: any) => {
? Promise.resolve(file)
: $root.$chooseDriveFile({
multiple: false,
type: 'image/*',
title: locale['desktop']['choose-banner']
});

View File

@ -77,6 +77,7 @@ init(async (launch, os) => {
if (document.body.clientWidth > 800) {
const w = this.$root.new(MkChooseFileFromDriveWindow, {
title: o.title,
type: o.type,
multiple: o.multiple,
initFolder: o.currentFolder
});

View File

@ -11,6 +11,7 @@
<x-drive
ref="browser"
class="browser"
:type="type"
:multiple="multiple"
@selected="onSelected"
@change-selection="onChangeSelection"
@ -33,6 +34,11 @@ export default Vue.extend({
XDrive: () => import('./drive.vue').then(m => m.default),
},
props: {
type: {
type: String,
required: false,
default: undefined
},
multiple: {
default: false
}

View File

@ -80,6 +80,11 @@ export default Vue.extend({
type: Object,
required: false
},
type: {
type: String,
required: false,
default: undefined
},
multiple: {
type: Boolean,
default: false
@ -540,6 +545,7 @@ export default Vue.extend({
//
this.$root.api('drive/files', {
folderId: this.folder ? this.folder.id : null,
type: this.type,
limit: filesMax + 1
}).then(files => {
if (files.length == filesMax + 1) {
@ -570,6 +576,7 @@ export default Vue.extend({
//
this.$root.api('drive/files', {
folderId: this.folder ? this.folder.id : null,
type: this.type,
untilId: this.files[this.files.length - 1].id,
limit: max + 1
}).then(files => {

View File

@ -8,6 +8,7 @@
</header>
<x-drive class="drive" ref="browser"
:select-file="true"
:type="type"
:multiple="multiple"
@change-selection="onChangeSelection"
@selected="onSelected"
@ -25,7 +26,7 @@ export default Vue.extend({
components: {
XDrive: () => import('./drive.vue').then(m => m.default),
},
props: ['multiple'],
props: ['type', 'multiple'],
data() {
return {
files: []