uni-number-box.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. (global.webpackJsonp = global.webpackJsonp || []).push([ [ "components/uni-number-box" ], {
  2. 504: function(e, n, t) {
  3. t.r(n);
  4. var i = t(505), a = t(507);
  5. for (var u in a) "default" !== u && function(e) {
  6. t.d(n, e, function() {
  7. return a[e];
  8. });
  9. }(u);
  10. t(509);
  11. var r = t(13), o = Object(r.default)(a.default, i.render, i.staticRenderFns, !1, null, null, null, !1, i.components, void 0);
  12. o.options.__file = "components/uni-number-box.vue", n.default = o.exports;
  13. },
  14. 505: function(e, n, t) {
  15. t.r(n);
  16. var i = t(506);
  17. t.d(n, "render", function() {
  18. return i.render;
  19. }), t.d(n, "staticRenderFns", function() {
  20. return i.staticRenderFns;
  21. }), t.d(n, "recyclableRender", function() {
  22. return i.recyclableRender;
  23. }), t.d(n, "components", function() {
  24. return i.components;
  25. });
  26. },
  27. 506: function(e, n, t) {
  28. t.r(n), t.d(n, "render", function() {
  29. return i;
  30. }), t.d(n, "staticRenderFns", function() {
  31. return u;
  32. }), t.d(n, "recyclableRender", function() {
  33. return a;
  34. }), t.d(n, "components", function() {});
  35. var i = function() {
  36. var e = this;
  37. e.$createElement;
  38. e._self._c;
  39. }, a = !1, u = [];
  40. i._withStripped = !0;
  41. },
  42. 507: function(e, n, t) {
  43. t.r(n);
  44. var i = t(508), a = t.n(i);
  45. for (var u in i) "default" !== u && function(e) {
  46. t.d(n, e, function() {
  47. return i[e];
  48. });
  49. }(u);
  50. n.default = a.a;
  51. },
  52. 508: function(e, n, t) {
  53. Object.defineProperty(n, "__esModule", {
  54. value: !0
  55. }), n.default = void 0;
  56. var i = {
  57. name: "uni-number-box",
  58. props: {
  59. isMax: {
  60. type: Boolean,
  61. default: !1
  62. },
  63. isMin: {
  64. type: Boolean,
  65. default: !1
  66. },
  67. index: {
  68. type: Number,
  69. default: 0
  70. },
  71. value: {
  72. type: Number,
  73. default: 0
  74. },
  75. min: {
  76. type: Number,
  77. default: -1 / 0
  78. },
  79. max: {
  80. type: Number,
  81. default: 1 / 0
  82. },
  83. step: {
  84. type: Number,
  85. default: 1
  86. },
  87. disabled: {
  88. type: Boolean,
  89. default: !1
  90. }
  91. },
  92. data: function() {
  93. return {
  94. inputValue: this.value,
  95. minDisabled: !1,
  96. maxDisabled: !1
  97. };
  98. },
  99. created: function() {
  100. this.maxDisabled = this.isMax, this.minDisabled = this.isMin;
  101. },
  102. computed: {},
  103. watch: {
  104. inputValue: function(e) {
  105. var n = {
  106. number: e,
  107. index: this.index
  108. };
  109. this.$emit("eventChange", n);
  110. }
  111. },
  112. methods: {
  113. _calcValue: function(e) {
  114. var n = this._getDecimalScale(), t = this.inputValue * n, i = 0, a = this.step * n;
  115. "subtract" === e ? ((i = t - a) <= this.min && (this.minDisabled = !0), i < this.min && (i = this.min),
  116. i < this.max && !0 === this.maxDisabled && (this.maxDisabled = !1)) : "add" === e && ((i = t + a) >= this.max && (this.maxDisabled = !0),
  117. i > this.max && (i = this.max), i > this.min && !0 === this.minDisabled && (this.minDisabled = !1)),
  118. i !== t && (this.inputValue = i / n);
  119. },
  120. _getDecimalScale: function() {
  121. var e = 1;
  122. return ~~this.step !== this.step && (e = Math.pow(10, (this.step + "").split(".")[1].length)),
  123. e;
  124. },
  125. _onBlur: function(e) {
  126. var n = e.detail.value;
  127. n ? ((n = +n) > this.max ? n = this.max : n < this.min && (n = this.min), this.inputValue = n) : this.inputValue = 0;
  128. }
  129. }
  130. };
  131. n.default = i;
  132. },
  133. 509: function(e, n, t) {
  134. t.r(n);
  135. var i = t(510), a = t.n(i);
  136. for (var u in i) "default" !== u && function(e) {
  137. t.d(n, e, function() {
  138. return i[e];
  139. });
  140. }(u);
  141. n.default = a.a;
  142. },
  143. 510: function(e, n, t) {}
  144. } ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "components/uni-number-box-create-component", {
  145. "components/uni-number-box-create-component": function(e, n, t) {
  146. t("1").createComponent(t(504));
  147. }
  148. }, [ [ "components/uni-number-box-create-component" ] ] ]);