LEDFont.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view>
  3. <view class="uni__number"
  4. :style="{ color: color,
  5. 'font-size': size+'px' ,
  6. 'height': height+'px',
  7. 'line-height': height+'px'}"> {{currentValue}}</view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: "LEDFont",
  13. props: {
  14. height: {
  15. type: Number,
  16. value: '28'
  17. },
  18. size: {
  19. type: Number,
  20. value: '24'
  21. },
  22. color: {
  23. type: String,
  24. default: '#000000'
  25. },
  26. showValue: {
  27. type: [Number,String],
  28. default: 0
  29. }
  30. },
  31. watch: {
  32. showValue(val) {
  33. // console.log('showValue:',val);
  34. this.currentValue = val;
  35. this.$forceUpdate()
  36. },
  37. },
  38. created: function(e) {
  39. this.currentValue = this.showValue;
  40. },
  41. data() {
  42. return {
  43. currentValut:0
  44. };
  45. }
  46. }
  47. </script>
  48. <style scoped>
  49. @font-face {
  50. font-family: 'UnidreamLED';
  51. src: url('~@/static/font/UnidreamLED.ttf');
  52. }
  53. .uni__number {
  54. /* #ifndef APP-NVUE */
  55. display: flex;
  56. /* #endif */
  57. justify-content: center;
  58. align-items: center;
  59. height: 56rpx;
  60. line-height: 56rpx;
  61. margin: 5rpx;
  62. text-align: center;
  63. font-size: 23px;
  64. font-family: UnidreamLED;
  65. border-radius: 3px;
  66. /* border: 1rpx solid #000000; */
  67. }
  68. </style>