You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.9 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <urban-filemanager>
  2. <div class="bucket-filemanager">
  3. <div class="file-table">
  4. <urban-filemanager-parent></urban-filemanager-parent>
  5. <template each={ file in state.files }>
  6. <urban-filemanager-file
  7. if={ file.is_file }
  8. file={ file }
  9. handleClick={ handleFileClick }
  10. handleMarked={ handleMarked }
  11. ></urban-filemanager-file>
  12. <urban-filemanager-directory
  13. if={ !file.is_file }
  14. file={ file }
  15. handleClick={ handleDirectoryClick }
  16. handleMarked={ handleMarked }
  17. ></urban-filemanager-directory>
  18. </template>
  19. </div>
  20. </div>
  21. <script>
  22. import axios from 'axios'
  23. import File from './file.riot'
  24. import Directory from './directory.riot'
  25. import Parent from './parent.riot'
  26. riot.register('urban-filemanager-file', File)
  27. riot.register('urban-filemanager-directory', Directory)
  28. riot.register('urban-filemanager-parent', Parent)
  29. export default {
  30. state: {
  31. files: [
  32. ],
  33. path: [
  34. ]
  35. },
  36. onBeforeMount(props, state) {
  37. state.files = props.files
  38. },
  39. handleFileClick() {
  40. },
  41. /**
  42. *
  43. *
  44. *
  45. */
  46. handleDirectoryClick(event, file) {
  47. this.state.path.push(file)
  48. axios.get('/api/file/' + this.props.id, {
  49. params: {
  50. path: this.state.path.join('/')
  51. }
  52. }).then((response) => {
  53. this.state.files = response.data.files
  54. this.update()
  55. })
  56. },
  57. handleMarked() {
  58. console.log('ddd')
  59. }
  60. }
  61. </script>
  62. </urban-filemanager>