Showing
2 changed files
with
56 additions
and
47 deletions
| ... | @@ -27,7 +27,6 @@ | ... | @@ -27,7 +27,6 @@ |
| 27 | $router.push({ | 27 | $router.push({ |
| 28 | name: 'Folder', | 28 | name: 'Folder', |
| 29 | params: { id: item.folder_id }, | 29 | params: { id: item.folder_id }, |
| 30 | - props: { folderId: item.id }, | ||
| 31 | }) | 30 | }) |
| 32 | " | 31 | " |
| 33 | > | 32 | > |
| ... | @@ -343,28 +342,34 @@ export default { | ... | @@ -343,28 +342,34 @@ export default { |
| 343 | }, | 342 | }, |
| 344 | }; | 343 | }; |
| 345 | }, | 344 | }, |
| 346 | - async created() { | 345 | + created() { |
| 347 | - try { | 346 | + this.fetchData(); |
| 348 | - const curData = { | 347 | + }, |
| 349 | - id: this.$store.state.id, | 348 | + watch: { |
| 350 | - folder_id: -1, | 349 | + $route: 'fetchData', |
| 351 | - }; | ||
| 352 | - console.log(curData); | ||
| 353 | - const response = await folder(curData); | ||
| 354 | - const file_response = await file(curData); | ||
| 355 | - this.$store.commit('setFolder', response.data.folders); | ||
| 356 | - this.$store.commit('setCur', response.data.cur); | ||
| 357 | - this.$store.commit('setParent', response.data.parentPath); | ||
| 358 | - this.$store.commit('setFile', file_response.data.files); | ||
| 359 | - this.folders = this.$store.getters.folderL; | ||
| 360 | - console.log(this.$store.getters.fileL); | ||
| 361 | - this.files = this.$store.getters.fileL; | ||
| 362 | - } catch (error) { | ||
| 363 | - console.log('에러'); | ||
| 364 | - console.log(error); | ||
| 365 | - } | ||
| 366 | }, | 350 | }, |
| 367 | methods: { | 351 | methods: { |
| 352 | + async fetchData() { | ||
| 353 | + try { | ||
| 354 | + const curData = { | ||
| 355 | + id: this.$store.state.id, | ||
| 356 | + folder_id: -1, | ||
| 357 | + }; | ||
| 358 | + console.log(curData); | ||
| 359 | + const response = await folder(curData); | ||
| 360 | + const file_response = await file(curData); | ||
| 361 | + this.$store.commit('setFolder', response.data.folders); | ||
| 362 | + this.$store.commit('setCur', response.data.cur); | ||
| 363 | + this.$store.commit('setParent', response.data.parentPath); | ||
| 364 | + this.$store.commit('setFile', file_response.data.files); | ||
| 365 | + this.folders = this.$store.getters.folderL; | ||
| 366 | + console.log(this.$store.getters.fileL); | ||
| 367 | + this.files = this.$store.getters.fileL; | ||
| 368 | + } catch (error) { | ||
| 369 | + console.log('에러'); | ||
| 370 | + console.log(error); | ||
| 371 | + } | ||
| 372 | + }, | ||
| 368 | handleFileUpload() { | 373 | handleFileUpload() { |
| 369 | this.uploadedfile = this.$refs.uploadedfile.files[0]; | 374 | this.uploadedfile = this.$refs.uploadedfile.files[0]; |
| 370 | console.log(this.uploadedfile); | 375 | console.log(this.uploadedfile); | ... | ... |
| ... | @@ -14,9 +14,7 @@ | ... | @@ -14,9 +14,7 @@ |
| 14 | <v-list two-line subheader> | 14 | <v-list two-line subheader> |
| 15 | <!-- <v-subheader inset>Folders</v-subheader> --> | 15 | <!-- <v-subheader inset>Folders</v-subheader> --> |
| 16 | <!-- Folder view --> | 16 | <!-- Folder view --> |
| 17 | - <v-list-item v-if="this.$store.state.cur !== '/'" @click="moveParent" | 17 | + <v-list-item @click="$router.go(-1)">...</v-list-item> |
| 18 | - >...</v-list-item | ||
| 19 | - > | ||
| 20 | <v-list-item | 18 | <v-list-item |
| 21 | v-for="item in this.$store.getters.folderL" | 19 | v-for="item in this.$store.getters.folderL" |
| 22 | :key="item.folder_id" | 20 | :key="item.folder_id" |
| ... | @@ -27,7 +25,6 @@ | ... | @@ -27,7 +25,6 @@ |
| 27 | $router.push({ | 25 | $router.push({ |
| 28 | name: 'Folder', | 26 | name: 'Folder', |
| 29 | params: { id: item.folder_id }, | 27 | params: { id: item.folder_id }, |
| 30 | - props: { folderId: item.folder_name }, | ||
| 31 | }) | 28 | }) |
| 32 | " | 29 | " |
| 33 | > | 30 | > |
| ... | @@ -312,13 +309,14 @@ import { | ... | @@ -312,13 +309,14 @@ import { |
| 312 | modifyFile, | 309 | modifyFile, |
| 313 | } from '../api/index'; | 310 | } from '../api/index'; |
| 314 | import Axios from 'axios'; | 311 | import Axios from 'axios'; |
| 312 | + | ||
| 315 | export default { | 313 | export default { |
| 316 | props: { | 314 | props: { |
| 317 | folderId: Number, | 315 | folderId: Number, |
| 318 | }, | 316 | }, |
| 319 | data() { | 317 | data() { |
| 320 | return { | 318 | return { |
| 321 | - folder_id: this.folderId, | 319 | + folder_id: this.$route.params.id, |
| 322 | uploadedfile: null, | 320 | uploadedfile: null, |
| 323 | foldername: '', | 321 | foldername: '', |
| 324 | curfName: {}, | 322 | curfName: {}, |
| ... | @@ -347,29 +345,35 @@ export default { | ... | @@ -347,29 +345,35 @@ export default { |
| 347 | }, | 345 | }, |
| 348 | }; | 346 | }; |
| 349 | }, | 347 | }, |
| 350 | - async created() { | 348 | + created() { |
| 351 | - try { | 349 | + this.fetchData(); |
| 352 | - console.log(this.$route.params.id); | 350 | + }, |
| 353 | - const curData = { | 351 | + watch: { |
| 354 | - id: this.$store.state.id, | 352 | + $route: 'fetchData', |
| 355 | - folder_id: this.$route.params.id, | ||
| 356 | - }; | ||
| 357 | - console.log(curData); | ||
| 358 | - const response = await folder(curData); | ||
| 359 | - // const file_response = await file(curData); | ||
| 360 | - this.$store.commit('setFolder', response.data.folders); | ||
| 361 | - this.$store.commit('setCur', response.data.cur); | ||
| 362 | - this.$store.commit('setParent', response.data.parentPath); | ||
| 363 | - this.$store.commit('setFile', response.data.files); | ||
| 364 | - this.folders = this.$store.getters.folderL; | ||
| 365 | - console.log(this.$store.getters.fileL); | ||
| 366 | - this.files = this.$store.getters.fileL; | ||
| 367 | - } catch (error) { | ||
| 368 | - console.log('에러'); | ||
| 369 | - console.log(error); | ||
| 370 | - } | ||
| 371 | }, | 353 | }, |
| 372 | methods: { | 354 | methods: { |
| 355 | + async fetchData() { | ||
| 356 | + try { | ||
| 357 | + console.log(this.$route.params.id); | ||
| 358 | + const curData = { | ||
| 359 | + id: this.$store.state.id, | ||
| 360 | + folder_id: this.$route.params.id, | ||
| 361 | + }; | ||
| 362 | + console.log(curData); | ||
| 363 | + const response = await folder(curData); | ||
| 364 | + // const file_response = await file(curData); | ||
| 365 | + this.$store.commit('setFolder', response.data.folders); | ||
| 366 | + this.$store.commit('setCur', response.data.cur); | ||
| 367 | + this.$store.commit('setParent', response.data.parentPath); | ||
| 368 | + this.$store.commit('setFile', response.data.files); | ||
| 369 | + this.folders = this.$store.getters.folderL; | ||
| 370 | + console.log(this.$store.getters.fileL); | ||
| 371 | + this.files = this.$store.getters.fileL; | ||
| 372 | + } catch (error) { | ||
| 373 | + console.log('에러'); | ||
| 374 | + console.log(error); | ||
| 375 | + } | ||
| 376 | + }, | ||
| 373 | handleFileUpload() { | 377 | handleFileUpload() { |
| 374 | this.uploadedfile = this.$refs.uploadedfile.files[0]; | 378 | this.uploadedfile = this.$refs.uploadedfile.files[0]; |
| 375 | console.log(this.uploadedfile); | 379 | console.log(this.uploadedfile); | ... | ... |
-
Please register or login to post a comment