-
-
- {{ file.name }}
-
+
+
-
-
-
-
+
+
+
+
+ {{ file.name }}
+
+
+
+
+
+
+
+
@@ -39,9 +58,14 @@ export default {
name: "Browser",
components: {DropdownItem, Dropdown, Loading},
mixins: [Utils, MediaUtils],
- emits: ['path-change'],
+ emits: ['back', 'path-change', 'play'],
props: {
+ hasBack: {
+ type: Boolean,
+ default: false,
+ },
+
initialPath: {
type: String,
},
@@ -71,11 +95,24 @@ export default {
return this.files.filter((file) => (file?.name || '').toLowerCase().indexOf(this.filter.toLowerCase()) >= 0)
},
+
+ pathTokens() {
+ if (!this.path?.length)
+ return ['/']
+
+ return ['/', ...this.path.split(/(? {
+ // Scroll to the end of the path navigator
+ this.$refs.nav.scrollLeft = 99999
+ // Scroll to the top of the items list
+ this.$refs.items.scrollTop = 0
+ })
try {
this.files = await this.request('file.list', {path: this.path})
@@ -84,6 +121,13 @@ export default {
this.loading = false
}
},
+
+ onBack() {
+ if (!this.path?.length || this.path === '/')
+ this.$emit('back')
+ else
+ this.path = [...this.pathTokens].slice(0, -1).join('/').slice(1)
+ },
},
mounted() {
@@ -96,12 +140,50 @@ export default {