Blame view

examples/routers/input-number.vue 4.12 KB
ce176e21   梁灏   fixed #3081
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
  <!--<template>-->
      <!--<div>-->
          <!--&lt;!&ndash;<Input-number :max="max" name="he" :min="-1" v-model="v1" :autofocus="autofocus"></Input-number>&ndash;&gt;-->
          <!--&lt;!&ndash;{{ v1 }}&ndash;&gt;-->
          <!--&lt;!&ndash;<div @click="c">change v1</div>&ndash;&gt;-->
          <!--&lt;!&ndash;<div @click="changeMax">change max</div>&ndash;&gt;-->
          <!--&lt;!&ndash;<Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number>&ndash;&gt;-->
          <!--&lt;!&ndash;<Input-number :max="10" :min="1" v-model="obj.v"></Input-number>&ndash;&gt;-->
          <!--<InputNumber :editable="false" :max="10" :min="1" :step="1.2" v-model="value2"></InputNumber>-->
          <!--<InputNumber :precision="1" :max="10" :min="1" :step="0.1" v-model="value1"></InputNumber>-->
      <!--</div>-->
  <!--</template>-->
  <!--<script>-->
      <!--export default {-->
          <!--props: {},-->
          <!--data () {-->
              <!--return {-->
                  <!--v1: 1,-->
                  <!--v2: 1,-->
                  <!--max: 10,-->
                  <!--autofocus: true,-->
                  <!--obj: {-->
  
                  <!--},-->
                  <!--value1: 1.0,-->
                  <!--value2: 1-->
              <!--};-->
          <!--},-->
          <!--computed: {},-->
          <!--methods: {-->
              <!--c () {-->
                  <!--this.v1 = 5;-->
              <!--},-->
              <!--changeMax () {-->
                  <!--this.max++;-->
              <!--}-->
          <!--}-->
      <!--};-->
  <!--</script>-->
  
  
c97c42ab   梁灏   support InputNumber
42
43
  <template>
      <div>
4d093b50   huanghong   fixed input-numbe...
44
          <!-- <InputNumber :max="1000000000" :min="1" v-model="value1" :formatter="formatter" :parser="parser" @on-change="change" style="width: 200px"></InputNumber>
ce176e21   梁灏   fixed #3081
45
          <InputNumber :max="1000000000" :min="1" v-model="value2" :formatter="formatter2" :parser="parser2" @on-change="change" style="width: 200px"></InputNumber>
10d29acb   huanghong   InputNumber suppo...
46
47
48
49
50
          
          <InputNumber @on-change="change" style="width: 200px"></InputNumber>
          
          <InputNumber v-model="valueNull" @on-change="change" style="width: 200px"></InputNumber>
          <InputNumber v-model="valueNull" @on-change="change" :formatter="formatter" :parser="parser" style="width: 200px"></InputNumber>
3d4fd6df   angela-1   在safari浏览器中需要去除mo...
51
52
                  
          <InputNumber v-model="value2" @on-focus="focus" style="width: 200px"></InputNumber>
01001332   xiaofengsha   添加inputNumber组件pl...
53
  
4d093b50   huanghong   fixed input-numbe...
54
55
56
          <InputNumber v-model="value3" style="width: 200px" placeholder="Enter something..."></InputNumber> -->
  
          
7adf94a2   huanghong   update
57
          <InputNumber v-model="valueNull" style="width: 200px" :min='1' :max='10000'  :precision='2' ></InputNumber>
886aeeb0   huanghong   update input-number
58
          <InputNumber v-model="valueNull" style="width: 200px" ></InputNumber>
7adf94a2   huanghong   update
59
          <div style="margin:10px 0px">
457d6c69   huanghong   add prop active-c...
60
61
62
63
              <InputNumber :activeChange="false" v-model="valueNull" style="width: 200px" :min='1' :max='10000'  :precision='2' ></InputNumber>
              <InputNumber :activeChange="false" v-model="valueNull" style="width: 200px" ></InputNumber>
          </div>
          <div style="margin:10px 0px">
7adf94a2   huanghong   update
64
65
66
67
68
69
70
71
72
73
74
              <InputNumber
                  :max="10000"
                  v-model="value9"
                  :formatter="value => `$ ${value}`.replace(/B(?=(d{3})+(?!d))/g, ',')"
                  :parser="value => value.replace(/\$s?|(,*)/g, '')"></InputNumber>
              <InputNumber
                  :max="100"
                  v-model="value10"
                  :formatter="value => `${value}%`"
                  :parser="value => value.replace('%', '')"></InputNumber>
          </div>
c97c42ab   梁灏   support InputNumber
75
76
77
78
      </div>
  </template>
  <script>
      export default {
c97c42ab   梁灏   support InputNumber
79
80
          data () {
              return {
ce176e21   梁灏   fixed #3081
81
82
                  value1: 1800000,
                  value2: 55,
01001332   xiaofengsha   添加inputNumber组件pl...
83
                  value3: 100,
10d29acb   huanghong   InputNumber suppo...
84
                  valueNull:null,
ce176e21   梁灏   fixed #3081
85
86
87
                  formatter: (value) => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ','),
                  parser: (value) => value.replace(/\$\s?|(,*)/g, ''),
                  formatter2: (value) => `${value}%`,
7adf94a2   huanghong   update
88
89
90
91
                  parser2: (value) => value.replace('%', ''),
                  value9: 1000,
                  value10: 100
              };
c97c42ab   梁灏   support InputNumber
92
          },
c97c42ab   梁灏   support InputNumber
93
          methods: {
3d4fd6df   angela-1   在safari浏览器中需要去除mo...
94
              focus (e) {
7adf94a2   huanghong   update
95
                  e.target.select();
3d4fd6df   angela-1   在safari浏览器中需要去除mo...
96
              },
ce176e21   梁灏   fixed #3081
97
              change (v) {
7adf94a2   huanghong   update
98
                  console.log(v);
c97c42ab   梁灏   support InputNumber
99
100
              }
          }
7adf94a2   huanghong   update
101
      };
ce176e21   梁灏   fixed #3081
102
  </script>