number-box.nvue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="page">
  3. <text class="example-info">数字输入框组件多用于购物车加减商品等场景</text>
  4. <uni-section title="基本用法" type="line"></uni-section>
  5. <view class="example-body">
  6. <uni-number-box />
  7. </view>
  8. <uni-section title="设置最小值和最大值" type="line"></uni-section>
  9. <view class="example-body">
  10. <uni-number-box :min="2" :max="9" :value="5" />
  11. </view>
  12. <uni-section title="设置步长(步长0.1)" type="line"></uni-section>
  13. <view class="example-body">
  14. <uni-number-box :step="0.1" />
  15. </view>
  16. <uni-section title="禁用状态" type="line"></uni-section>
  17. <view class="example-body">
  18. <uni-number-box :disabled="true" />
  19. </view>
  20. <uni-section :title="'获取输入的值 : '+numberValue" type="line"></uni-section>
  21. <view class="example-body">
  22. <uni-number-box :value="numberValue" @change="change" />
  23. </view>
  24. <!-- <view style="height: 30rpx;"></view> -->
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. components: {},
  30. data() {
  31. return {
  32. numberValue: 0
  33. }
  34. },
  35. methods: {
  36. change(value) {
  37. this.numberValue = value
  38. }
  39. }
  40. }
  41. </script>
  42. <style>
  43. @charset "UTF-8";
  44. /* 头条小程序组件内不能引入字体 */
  45. /* #ifdef MP-TOUTIAO */
  46. @font-face {
  47. font-family: uniicons;
  48. font-weight: normal;
  49. font-style: normal;
  50. src: url("~@/static/uni.ttf") format("truetype");
  51. }
  52. /* #endif */
  53. /* #ifndef APP-NVUE */
  54. page {
  55. display: flex;
  56. flex-direction: column;
  57. box-sizing: border-box;
  58. background-color: #efeff4;
  59. min-height: 100%;
  60. height: auto;
  61. }
  62. view {
  63. font-size: 14px;
  64. line-height: inherit;
  65. }
  66. .example {
  67. padding: 0 15px 15px;
  68. }
  69. .example-info {
  70. padding: 15px;
  71. color: #3b4144;
  72. background: #ffffff;
  73. }
  74. .example-body {
  75. /* #ifndef APP-NVUE */
  76. display: flex;
  77. /* #endif */
  78. flex-direction: row;
  79. flex-wrap: wrap;
  80. justify-content: center;
  81. padding: 0;
  82. font-size: 14px;
  83. background-color: #ffffff;
  84. }
  85. /* #endif */
  86. .example {
  87. padding: 0 15px;
  88. }
  89. .example-info {
  90. /* #ifndef APP-NVUE */
  91. display: block;
  92. /* #endif */
  93. padding: 15px;
  94. color: #3b4144;
  95. background-color: #ffffff;
  96. font-size: 14px;
  97. line-height: 20px;
  98. }
  99. .example-info-text {
  100. font-size: 14px;
  101. line-height: 20px;
  102. color: #3b4144;
  103. }
  104. .example-body {
  105. flex-direction: column;
  106. padding: 15px;
  107. background-color: #ffffff;
  108. }
  109. .word-btn-white {
  110. font-size: 18px;
  111. color: #FFFFFF;
  112. }
  113. .word-btn {
  114. /* #ifndef APP-NVUE */
  115. display: flex;
  116. /* #endif */
  117. flex-direction: row;
  118. align-items: center;
  119. justify-content: center;
  120. border-radius: 6px;
  121. height: 48px;
  122. margin: 15px;
  123. background-color: #007AFF;
  124. }
  125. .word-btn--hover {
  126. background-color: #4ca2ff;
  127. }
  128. </style>