石广澎
2023-10-20 4cb068fb1d51129be7199cbd83fb0ef1f97915e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
  <div class="component">
    <el-input-number
      style="width: 100%!important;text-align: left"
      v-bind="$attrs"
      v-on="$listeners"
      :value="value"
      :controls-position="controlsPosition"
      :precision="precision"
      :step="step"
      :min="min"
      :max="max"
      :placeholder="placeholder"
      clearable
    >
 
    </el-input-number>
    <p class="text">{{text}}</p>
 
  </div>
</template>
 
<script>
export default {
  name: 'myInputNumber',
  props: {
    text:[String],
    value: {
      type: [Number,String],
    },
    placeholder: {
      type: String,
      default: '',
    },
    controlsPosition: {
      type: Object,
      default: () => {},
    },
    label: {
      type: String,
      default: '',
    },
    step: {
      type: Number,
      default: 0.1,
    },
    min: {
      type: Number,
      default: 0,
    },
    max: {
      type: Number,
      default: 999,
    },
    //精度 1 1位小数 2 2位小数 类推
    precision: {
      type: Number,
      default: 0,
    },
  }
};
</script>
 
<style scoped lang="scss">
.component{
  width: 100%;
  position: relative;
  overflow: hidden;
  .text{
    position: absolute;
    top: 1px;
    bottom: 1px;
    right: 1px;
    text-align: center;
    background-color: #f5f7fa;
    border-left: 1px solid #dcdfe6;
    padding: 0 20px;
    border-radius: 4px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    color: #909399;
  }
}
>>> .el-input-number__decrease {
  display: none;
}
>>> .el-input-number__increase {
  display: none;
}
>>> .el-input--medium .el-input__inner{
  text-align: left;
  padding: 15px;
}
</style>