ai.touchui-vue 1.33.0 → 1.33.2

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/lib/input.js CHANGED
@@ -206,7 +206,7 @@ module.exports = require("ai.touchui-vue/lib/mixins/locale");
206
206
  // ESM COMPAT FLAG
207
207
  __webpack_require__.r(__webpack_exports__);
208
208
 
209
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=4a775748
209
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=7002140a
210
210
  var render = function () {
211
211
  var _vm = this
212
212
  var _h = _vm.$createElement
@@ -610,7 +610,7 @@ var staticRenderFns = []
610
610
  render._withStripped = true
611
611
 
612
612
 
613
- // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=4a775748
613
+ // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=7002140a
614
614
 
615
615
  // CONCATENATED MODULE: ./src/utils/string.js
616
616
  function filter(chars, from) {
@@ -1060,7 +1060,7 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1060
1060
  if (this.inited) {
1061
1061
 
1062
1062
  // 处理 IOS 下,to-input type=number 可以输入小数点
1063
- if (this.type === 'number' && Number(this.dot) === 0 && !this.conversionType && String(this.data).indexOf('.') > -1) {
1063
+ if (this.type === 'number' && Number(this.dot) === 0 && !Number(this.conversionType) && String(this.data).indexOf('.') > -1) {
1064
1064
  this.data = this.data.replace('.', '');
1065
1065
  }
1066
1066
  if (this.spChars) {
@@ -1137,7 +1137,7 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1137
1137
  }
1138
1138
  },
1139
1139
  inputKeyPress: function inputKeyPress(event) {
1140
- if (this.type === 'number' && !this.conversionType) {
1140
+ if (this.type === 'number' && !Number(this.conversionType)) {
1141
1141
  if ((event.keyCode !== 46 || Number(this.dot) === 0) && (event.keyCode !== 45 || Number(this.min) >= 0) && (event.keyCode < 48 || event.keyCode > 57)) {
1142
1142
  event.returnValue = false;
1143
1143
  }
@@ -1206,8 +1206,8 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1206
1206
  this.data = 'NaN';
1207
1207
  }
1208
1208
 
1209
- if (this.conversionType) {
1210
- this.data = this.formatNumber(this.data, this.dot, this.conversionType);
1209
+ if (Number(this.conversionType)) {
1210
+ this.data = this.formatNumber(this.data, this.dot, Number(this.conversionType));
1211
1211
  }
1212
1212
  }
1213
1213
  this.focused = false;
@@ -1249,7 +1249,7 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1249
1249
  var pre = this.data.substring(0, this.data.indexOf('.'));
1250
1250
  var suf = this.data.substring(this.data.indexOf('.') + 1);
1251
1251
 
1252
- if (!this.conversionType) {
1252
+ if (!Number(this.conversionType)) {
1253
1253
  // 去掉小数点之后的所有小圆点并截取所需数量
1254
1254
  suf = suf.replace(/[/.]/g, '').substring(0, Number(this.dot));
1255
1255
  }
@@ -1311,25 +1311,6 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1311
1311
  // type 0:保持原状 1:向上取值 2:向下取值 3:四舍五入 4:保持原值无限输入小数
1312
1312
  if (type < 0 || type > 3) throw new Error('Invalid type');
1313
1313
 
1314
- // if (type === 0) {
1315
- // // 处理科学计数法并转换为字符串
1316
- // let strValue = value.toLocaleString('fullwide', { useGrouping: false });
1317
- // // 处理特殊情况,例如数值本身是整数
1318
- // if (strValue.indexOf('.') === -1) strValue += '.';
1319
-
1320
- // const [intPart, decimalPart = ''] = strValue.split('.');
1321
- // let formattedDecimal = decimalPart;
1322
-
1323
- // // 补零到指定的小数位数
1324
- // if (decimalPart.length < decimalPlaces) {
1325
- // formattedDecimal = decimalPart.padEnd(decimalPlaces, '0');
1326
- // }
1327
-
1328
- // return decimalPlaces === 0
1329
- // ? intPart
1330
- // : `${intPart}.${formattedDecimal}`;
1331
- // }
1332
-
1333
1314
  var factor = Math.pow(10, decimalPlaces);
1334
1315
  var processedValue = value;
1335
1316
 
@@ -1344,9 +1325,15 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1344
1325
  break;
1345
1326
  case 3:
1346
1327
  // 四舍五入
1347
- processedValue = Math.round(value * factor) / factor;
1328
+ processedValue = Math.round(Number((value * factor).toFixed(1))) / factor;
1329
+ // processedValue = this.preciseMultiply(value, factor);
1348
1330
  break;
1349
1331
  }
1332
+ // console.log(value, 'value')
1333
+ // console.log(factor, 'factor')
1334
+ // console.log('processedValue', processedValue)
1335
+ // console.log('value * factor * 10', value * factor * 10)
1336
+ // console.log('Math.round(value * factor * 10)', Math.round(value * factor * 10))
1350
1337
  return processedValue.toFixed(decimalPlaces);
1351
1338
  }
1352
1339
  }