scannum.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="u-m-t-32 inp">
  3. <input :placeholder="'请输入含' + `${places}` + '位小数点的数值'" @blur="handleDi" placeholder-style="color: #B3B3B3; magin-top: 10rpx;" type="digit" v-model="numb_value" />
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. props: {
  9. //拍照选项项目巡检id
  10. scan_id: {
  11. type: Number
  12. },
  13. //小数位数
  14. places: {
  15. type: Number
  16. },
  17. //最小值
  18. min: {
  19. type:Number
  20. },
  21. //最大值
  22. max: {
  23. type:Number
  24. }
  25. },
  26. data() {
  27. return {
  28. numb_value:'',
  29. }
  30. },
  31. methods: {
  32. //处理巡检提交数据
  33. submit() {
  34. let item = {
  35. id: this.scan_id,
  36. value: this.numb_value
  37. } //提交数据
  38. this.$store.state.user.items.push(item)
  39. // }
  40. },
  41. //input修改
  42. handleDi(e) {
  43. if(this.min != 0 && this.max != 0) {
  44. if(e.detail.value > this.max) {
  45. this.$refs.sacast.show({
  46. title: "数值超过最大值",
  47. type: 'info',
  48. })
  49. } else if(e.detail.value < this.min) {
  50. this.$refs.sacast.show({
  51. title: "数值不得小于最小值",
  52. type: 'info',
  53. })
  54. }
  55. }
  56. },
  57. //重置表单
  58. reset() {
  59. this.numb_value = ''
  60. }
  61. }
  62. }
  63. </script>
  64. <style>
  65. input {
  66. width: 100%;
  67. height: 100%;
  68. /* text-indent: 20rpx; */
  69. }
  70. .inp {
  71. width: 690rpx;
  72. height: 80rpx;
  73. padding: 18rpx;
  74. border: 1rpx solid #BFBFBF;
  75. border-radius: 6rpx;
  76. }
  77. </style>