Commit 74999a6421e4159ab503211bb8027b277a95f541

Authored by Aresn
Committed by GitHub
2 parents d759a6c6 01001332

Merge pull request #3424 from xiaofengsha/pr005

inputNumber组件添加placeholder属性
examples/routers/input-number.vue
... ... @@ -50,6 +50,8 @@
50 50 <InputNumber v-model="valueNull" @on-change="change" :formatter="formatter" :parser="parser" style="width: 200px"></InputNumber>
51 51  
52 52 <InputNumber v-model="value2" @on-focus="focus" style="width: 200px"></InputNumber>
  53 +
  54 + <InputNumber v-model="value3" style="width: 200px" placeholder="Enter something..."></InputNumber>
53 55 </div>
54 56 </template>
55 57 <script>
... ... @@ -58,6 +60,7 @@
58 60 return {
59 61 value1: 1800000,
60 62 value2: 55,
  63 + value3: 100,
61 64 valueNull:null,
62 65 formatter: (value) => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ','),
63 66 parser: (value) => value.replace(/\$\s?|(,*)/g, ''),
... ...
src/components/input-number/input-number.vue
... ... @@ -30,7 +30,8 @@
30 30 @change="change"
31 31 :readonly="readonly || !editable"
32 32 :name="name"
33   - :value="formatterValue">
  33 + :value="formatterValue"
  34 + :placeholder="placeholder">
34 35 </div>
35 36 </div>
36 37 </template>
... ... @@ -120,7 +121,11 @@
120 121 },
121 122 parser: {
122 123 type: Function
123   - }
  124 + },
  125 + placeholder: {
  126 + type: String,
  127 + default: ''
  128 + },
124 129 },
125 130 data () {
126 131 return {
... ...