sumNumber.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="sumNumberContainer">
  3. <div class="imgContainer">
  4. <span v-for="n in imgNumber">
  5. <em v-if="n == 0"><img src="../static/img/num/0.svg" alt=""></em>
  6. <em v-if="n == 1"><img src="../static/img/num/1.svg" alt=""></em>
  7. <em v-if="n == 2"><img src="../static/img/num/2.svg" alt=""></em>
  8. <em v-if="n == 3"><img src="../static/img/num/3.svg" alt=""></em>
  9. <em v-if="n == 4"><img src="../static/img/num/4.svg" alt=""></em>
  10. <em v-if="n == 5"><img src="../static/img/num/5.svg" alt=""></em>
  11. <em v-if="n == 6"><img src="../static/img/num/6.svg" alt=""></em>
  12. <em v-if="n == 7"><img src="../static/img/num/7.svg" alt=""></em>
  13. <em v-if="n == 8"><img src="../static/img/num/8.svg" alt=""></em>
  14. <em v-if="n == 9"><img src="../static/img/num/9.svg" alt=""></em>
  15. </span>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. imgNumber: ''
  24. }
  25. },
  26. props: ['curNumber'],
  27. mounted(){
  28. this.imgNumber = this.curNumber.toString();
  29. },
  30. watch: {
  31. 'curNumber' (val) {
  32. this.numTurnImg(val);
  33. }
  34. },
  35. methods: {
  36. numTurnImg(num){
  37. this.imgNumber = num.toString();
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped>
  43. .sumNumberContainer {
  44. width: 100%;
  45. /*width: 960px;*/
  46. overflow: hidden;
  47. display: block;
  48. margin: 0 auto;
  49. }
  50. .imgContainer {
  51. width: 100%;
  52. overflow: hidden;
  53. display: flex;
  54. margin: 0 auto;
  55. justify-content: center;
  56. text-align: center;
  57. align-items:center;
  58. flex: 1;
  59. border-radius: 33rem;
  60. /*background: linear-gradient(#000 0%, rgba(0, 0, 0, 0.1) 100%);*/
  61. }
  62. .imgContainer span {
  63. /*width: 30px;*/
  64. /*display: flex;*/
  65. display: inline-block;
  66. float: none;
  67. /*justify-content: center;*/
  68. /*align-items:center;*/
  69. /*flex: 1;*/
  70. }
  71. .imgContainer span em img {
  72. /*width: 100%;*/
  73. width: 1.3rem;
  74. height: 2rem;
  75. overflow: hidden;
  76. display: block;
  77. margin: 0 auto;
  78. }
  79. </style>