gyyg-components 0.2.11 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gyyg-components",
3
- "version": "0.2.11",
3
+ "version": "0.2.14",
4
4
  "private": false,
5
5
  "main": "lib/gyyg-components.umd.js",
6
6
  "scripts": {
@@ -12,12 +12,12 @@
12
12
  :start-placeholder="startPlaceholder"
13
13
  :end-placeholder="endPlaceholder"
14
14
  :range-separator="rangeSeparator"
15
+ :value-format="valueFormat"
15
16
  style="width: 100%;">
16
17
  </el-date-picker>
17
18
  </div>
18
19
  </template>
19
20
  <script>
20
- import moment from 'moment';
21
21
  export default {
22
22
  name: 'mec-date-picker',
23
23
  props: {
@@ -60,7 +60,7 @@ export default {
60
60
  },
61
61
  valueFormat: {
62
62
  type: String,
63
- default: ''
63
+ default: 'yyyy-MM-dd'
64
64
  }
65
65
 
66
66
  },
@@ -71,9 +71,7 @@ export default {
71
71
  },
72
72
  methods: {
73
73
  change(val) {
74
- const formattedValue = val ? moment(val).format(this.valueFormat) : '';
75
- this.$emit('change', formattedValue);
76
- this.$emit('input', formattedValue);
74
+ this.$emit('change', val);
77
75
  }
78
76
  },
79
77
  watch: {
@@ -85,9 +83,7 @@ export default {
85
83
  },
86
84
  date: {
87
85
  handler(val) {
88
- // 将内部的 Date 对象格式化后传递给父组件
89
- const formattedValue = val ? moment(val).format(this.valueFormat) : '';
90
- this.$emit('input', formattedValue);
86
+ this.$emit('input', val);
91
87
  }
92
88
 
93
89
  }
@@ -119,7 +119,6 @@
119
119
  methods: {
120
120
  handleInput(val) {
121
121
  let value = val;
122
-
123
122
  if (this.inputType === 'number') {
124
123
  // 只允许输入数字
125
124
  value = value.replace(/[^0-9]/g, '');
@@ -129,6 +128,13 @@
129
128
  } else if (this.inputType === 'english') {
130
129
  // 只允许输入英文
131
130
  value = value.replace(/[^a-zA-Z\s]/g, '');
131
+ }else if (this.inputType === 'amount') {
132
+ // 只允许输入数字和小数点
133
+ value = value.replace(/[^0-9.]/g, '');
134
+ // 确保小数点只出现一次
135
+ if (value.split('.').length > 2) {
136
+ value = value.replace(/\.+$/, '');
137
+ }
132
138
  }
133
139
  this.inputValue = value
134
140
  this.$emit('input', value);
@@ -70,7 +70,7 @@
70
70
  :scope="scope"
71
71
  :tableData="col"
72
72
  v-model="scope.row[col.bind]"
73
- v-bind="col.componentProps || {}"
73
+ v-bind="typeof col.componentProps === 'function' ? col.componentProps(scope.row) : col.componentProps"
74
74
  v-on="col.componentListeners || {}"
75
75
  ></component>
76
76
  </template>
@@ -2,7 +2,7 @@
2
2
  <el-transfer
3
3
  v-model="rightData"
4
4
  :data="data"
5
- :titles=titles
5
+ :titles="titles"
6
6
  :left-default-checked="leftDefaultChecked"
7
7
  :right-default-checked="rightDefaultChecked"
8
8
  :props="props"
@@ -14,7 +14,6 @@
14
14
  >
15
15
  </el-transfer>
16
16
  </template>
17
- </template>
18
17
  <script>
19
18
  import Sortable from 'sortablejs';
20
19
  export default {