四零语境前端代码仓库
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.

73 lines
1.7 KiB

  1. <template>
  2. <view class="yingbing-reader-header">
  3. <view class="yingbing-reader-header-left">
  4. <view class="yingbing-reader-header-back" :style="{'border-top-color': color, 'border-left-color': color}" v-if="backShow"
  5. @touchstart.stop.prevent @touchmove.stop.prevent @touchend.stop.prevent="handleBack"
  6. @mousedown.stop.prevent @mousemove.stop.prevent @mouseup.stop.prevent="handleBack"></view>
  7. <text class="yingbing-reader-header-text" :style="{color: color}">{{title}}</text>
  8. </view>
  9. <text class="yingbing-reader-header-text" :style="{color: color}" v-if="progress">{{progress.toFixed(2)}}%</text>
  10. </view>
  11. </template>
  12. <script>
  13. import Battery from '../battery/battery.vue'
  14. export default {
  15. inject: ['getColor', 'getBackShow'],
  16. props: {
  17. title: {
  18. type: String,
  19. default: ''
  20. },
  21. progress: {
  22. type: [Number, String],
  23. default: 0
  24. }
  25. },
  26. computed: {
  27. color () {
  28. return this.getColor()
  29. },
  30. backShow () {
  31. return this.getBackShow()
  32. }
  33. },
  34. methods: {
  35. handleBack (e) {
  36. e.preventDefault && e.preventDefault()
  37. e.stopPropagation && e.stopPropagation()
  38. uni.$emit('yingbing-reader-back')
  39. }
  40. }
  41. }
  42. </script>
  43. <style>
  44. .yingbing-reader-header {
  45. display: flex;
  46. flex-direction: row;
  47. align-items: center;
  48. justify-content: space-between;
  49. margin-bottom: 10px;
  50. height: 20px;
  51. }
  52. .yingbing-reader-header-left {
  53. display: flex;
  54. flex-direction: row;
  55. align-items: center;
  56. }
  57. .yingbing-reader-header-text {
  58. font-size: 10px;
  59. opacity: 0.5;
  60. }
  61. .yingbing-reader-header-back {
  62. width: 6px;
  63. height: 6px;
  64. border-top-width: 1px;
  65. border-left-width: 1px;
  66. border-top-style: solid;
  67. border-left-style: solid;
  68. transform: rotateZ(-45deg);
  69. margin-right: 5px;
  70. opacity: 0.5;
  71. }
  72. </style>