reader.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <reader-component :novel-id="novelId" @back="handleBack" @search="handleSearch" @add-to-shelf="handleAddToShelf"
  3. @add-bookmark="handleAddBookmark" @show-notes="handleShowNotes" @show-progress="handleShowProgress"
  4. @prev-page="handlePrevPage" @next-page="handleNextPage" @chapter-change="handleChapterChange"
  5. @chapter-loaded="handleChapterLoaded" @chapters-loaded="handleChaptersLoaded" @theme-change="handleThemeChange"
  6. @font-size-change="handleFontSizeChange" @margin-change="handleMarginChange"
  7. @line-height-change="handleLineHeightChange" />
  8. </template>
  9. <script>
  10. import ReaderComponent from './reader/reader-component.vue'
  11. export default {
  12. components: {
  13. ReaderComponent
  14. },
  15. data() {
  16. return {
  17. novelId: 1
  18. }
  19. },
  20. onLoad(options) {
  21. if (options && options.id) {
  22. this.novelId = Number(options.id)
  23. }
  24. },
  25. methods: {
  26. handleBack() {
  27. uni.navigateBack(1)
  28. console.log('返回上一页')
  29. },
  30. handleSearch() {
  31. console.log('搜索')
  32. },
  33. handleAddToShelf() {
  34. uni.showToast({
  35. title: '已加入书架',
  36. icon: 'success'
  37. })
  38. },
  39. handleAddBookmark() {
  40. console.log('添加书签')
  41. },
  42. handleShowNotes() {
  43. uni.showToast({
  44. title: '笔记功能开发中',
  45. icon: 'none'
  46. })
  47. },
  48. handleShowProgress() {
  49. uni.showToast({
  50. title: '进度功能开发中',
  51. icon: 'none'
  52. })
  53. },
  54. handlePrevPage() {
  55. console.log('上一页')
  56. },
  57. handleNextPage() {
  58. console.log('下一页')
  59. },
  60. handleChapterChange(chapter) {
  61. console.log('章节切换', chapter)
  62. },
  63. handleChapterLoaded(chapter) {
  64. console.log('章节加载完成', chapter)
  65. },
  66. handleChaptersLoaded(chapters) {
  67. console.log('目录加载完成', chapters)
  68. },
  69. handleThemeChange(index) {
  70. console.log('主题切换', index)
  71. },
  72. handleFontSizeChange(size) {
  73. console.log('字体大小改变', size)
  74. },
  75. handleMarginChange(margin) {
  76. console.log('边距改变', margin)
  77. },
  78. handleLineHeightChange(lineHeight) {
  79. console.log('行高改变', lineHeight)
  80. }
  81. }
  82. }
  83. </script>