LEDFont.vue 1.0 KB

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