Improve usability

This commit is contained in:
syuilo
2018-11-13 15:01:05 +09:00
parent 50824a7245
commit 7c9fb5228b
2 changed files with 52 additions and 3 deletions

View File

@@ -5,7 +5,13 @@
<p :class="$style.fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
<div :class="$style.stream" v-if="!fetching && images.length > 0">
<div v-for="image in images" :class="$style.img" :style="`background-image: url(${image.thumbnailUrl || image.url})`"></div>
<div v-for="image in images"
:class="$style.img"
:style="`background-image: url(${image.thumbnailUrl || image.url})`"
draggable="true"
@dragstart="onDragstart(image, $event)"
@dragend="onDragend"
></div>
</div>
<p :class="$style.empty" v-if="!fetching && images.length == 0">{{ $t('no-photos') }}</p>
</mk-widget-container>
@@ -31,6 +37,7 @@ export default define({
connection: null
};
},
mounted() {
this.connection = this.$root.stream.useSharedConnection('main');
@@ -44,9 +51,11 @@ export default define({
this.fetching = false;
});
},
beforeDestroy() {
this.connection.dispose();
},
methods: {
onDriveFileCreated(file) {
if (/^image\/.+$/.test(file.type)) {
@@ -54,6 +63,7 @@ export default define({
if (this.images.length > 9) this.images.pop();
}
},
func() {
if (this.props.design == 2) {
this.props.design = 0;
@@ -62,7 +72,16 @@ export default define({
}
this.save();
}
},
onDragstart(file, e) {
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('mk_drive_file', JSON.stringify(file));
},
onDragend(e) {
this.browser.isDragSource = false;
},
}
});
</script>