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

54 lines
1.1 KiB

  1. <template>
  2. <view class="yingbing-content">
  3. <text space="nbsp" :selectable="selectable" :user-select="selectable" :style="[contentStyle]" v-for="(t, i) in item.contents" :key="i">{{t}}</text>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. inject: ['getColor', 'getFontSize', 'getFontFamily', 'getLineGap', 'getSelectable'],
  9. props: {
  10. item: {
  11. type: Object,
  12. default () {
  13. return new Object
  14. }
  15. }
  16. },
  17. computed: {
  18. color () {
  19. return this.getColor()
  20. },
  21. fontSize () {
  22. return this.getFontSize()
  23. },
  24. fontFamily () {
  25. return this.getFontFamily()
  26. },
  27. lineGap () {
  28. return this.getLineGap()
  29. },
  30. selectable () {
  31. return this.getSelectable()
  32. },
  33. contentStyle () {
  34. return {
  35. 'color': this.color,
  36. 'font-size': this.fontSize + 'px',
  37. 'font-family': this.fontFamily,
  38. 'margin-top': this.lineGap + 'px',
  39. 'height': this.fontSize + 'px'
  40. }
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .yingbing-content {
  47. box-sizing: border-box;
  48. /* #ifndef APP-NVUE */
  49. display: flex;
  50. /* #endif */
  51. flex-direction: column;
  52. }
  53. </style>