mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-26 15:23:04 +00:00
perf: 文件浏览支持滑动返回上一个文件夹
This commit is contained in:
parent
073b1937f0
commit
ba65c21a0b
@ -6,6 +6,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {mapState} from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MobileBack",
|
name: "MobileBack",
|
||||||
props: {
|
props: {
|
||||||
@ -42,6 +44,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(['files']),
|
||||||
|
|
||||||
style() {
|
style() {
|
||||||
const offset = 135;
|
const offset = 135;
|
||||||
const top = Math.max(offset, this.y) + this.windowScrollY,
|
const top = Math.max(offset, this.y) + this.windowScrollY,
|
||||||
@ -51,6 +55,15 @@ export default {
|
|||||||
left: this.x > 20 ? 0 : '-50px',
|
left: this.x > 20 ? 0 : '-50px',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
routeName() {
|
||||||
|
return this.$route.name
|
||||||
|
},
|
||||||
|
|
||||||
|
fileFolderId() {
|
||||||
|
const {folderId} = this.$route.params;
|
||||||
|
return parseInt(/^\d+$/.test(folderId) ? folderId : 0);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@ -100,13 +113,31 @@ export default {
|
|||||||
if (!this.showTabbar) {
|
if (!this.showTabbar) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.$Modal.visibles().length > 0;
|
if (this.$Modal.visibles().length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this.fileFolderId > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onBack() {
|
onBack() {
|
||||||
if (this.$Modal.removeLast()) {
|
if (this.$Modal.removeLast()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.fileFolderId > 0) {
|
||||||
|
const file = this.files.find(({id, permission}) => id == this.fileFolderId && permission > -1)
|
||||||
|
if (file) {
|
||||||
|
const prevFile = this.files.find(({id, permission}) => id == file.pid && permission > -1)
|
||||||
|
if (prevFile) {
|
||||||
|
this.goForward({name: 'manage-file', params: {folderId: prevFile.id, fileId: null}});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.goForward({name: 'manage-file'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.goBack();
|
this.goBack();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user