PdfController.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="pdf-controller">
  3. <!-- <icon :class="pageMarked ? 'active' : ''" @click="handleMarkButtonClicked"-->
  4. <!-- :unicode="pageMarked ? iconMap['mark'] : iconMap['mark_border']" title="收藏本页"/>-->
  5. <!-- <icon></icon>-->
  6. <a :href="src"><icon-button title="上一页">cloud_download</icon-button></a>
  7. <div class="spacer"></div>
  8. <icon-button @click="handlePrevious" title="上一页">navigate_before</icon-button>
  9. <icon-button @click="handleScreenShot" title="将本页截图">save_alt</icon-button>
  10. <icon-button @click="handleNext" title="下一页">navigate_next</icon-button>
  11. <div class="spacer"></div>
  12. <icon-button :theme="showDiscussion ? 'blue' : null" @click="handleDiscussionShowState" title="讨论区">char_bubble</icon-button>
  13. </div>
  14. </template>
  15. <script>
  16. import IconButton from '@/components/Basic/IconButton'
  17. import { NEXT_PAGE, PREVIOUS_PAGE, SET_SCREEN_SHOT, TOGGLE_SHOW_DISCUSSION } from '@/store/types/pdf-types'
  18. import { mapState } from 'vuex'
  19. export default {
  20. components: { IconButton },
  21. data () {
  22. return {
  23. pageMarked: false
  24. }
  25. },
  26. computed: {
  27. ...mapState({
  28. showDiscussion: state => state.pdf.showDiscussion,
  29. src: state => state.pdf.src
  30. })
  31. },
  32. methods: {
  33. handleMarkButtonClicked () {
  34. this.pageMarked = !this.pageMarked
  35. // todo
  36. },
  37. handleDiscussionShowState () {
  38. this.$store.commit(TOGGLE_SHOW_DISCUSSION)
  39. },
  40. handlePrevious () {
  41. this.$store.commit(PREVIOUS_PAGE)
  42. },
  43. handleNext () {
  44. this.$store.commit(NEXT_PAGE)
  45. },
  46. handleScreenShot () {
  47. this.$store.commit(SET_SCREEN_SHOT)
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. @import '~@/style/theme.scss';
  54. .pdf-controller {
  55. padding: 0 8px;
  56. max-width: 600px;
  57. margin: 8px auto;
  58. box-sizing: border-box;
  59. display: flex;
  60. align-items: center;
  61. justify-content: space-between;
  62. width: 100%;
  63. }
  64. .spacer {
  65. max-width: 24px;
  66. flex: 1;
  67. }
  68. @media (max-width: 480px) {
  69. .spacer {
  70. max-width: 12px;
  71. }
  72. }
  73. </style>