pages-componentsB-numberBox-numberBox.f95c79a0.js 17 KB

1
  1. (self["webpackChunkuview2_0_cli"]=self["webpackChunkuview2_0_cli"]||[]).push([[6432],{46141:function(e,t,n){var i=n(21208);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var u=n(56).Z;u("eade5dea",i,!0,{sourceMap:!1,shadowMode:!1})},57439:function(e,t,n){var i=n(870);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var u=n(56).Z;u("29122291",i,!0,{sourceMap:!1,shadowMode:!1})},50719:function(e,t,n){var i=n(48174);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals);var u=n(56).Z;u("3e43c668",i,!0,{sourceMap:!1,shadowMode:!1})},45829:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var i,u={uLine:n(36083).Z},o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"u-cell-group",class:[e.customClass],style:[e.$u.addStyle(e.customStyle)]},[e.title?n("v-uni-view",{staticClass:"u-cell-group__title"},[e._t("title",[n("v-uni-text",{staticClass:"u-cell-group__title__text"},[e._v(e._s(e.title))])])],2):e._e(),n("v-uni-view",{staticClass:"u-cell-group__wrapper"},[e.border?n("u-line"):e._e(),e._t("default")],2)],1)},a=[],l={props:{title:{type:String,default:uni.$u.props.cellGroup.title},border:{type:Boolean,default:uni.$u.props.cellGroup.border}}},s={name:"u-cell-group",mixins:[uni.$u.mpMixin,uni.$u.mixin,l]},r=s,c=(n(46141),n(69453)),d=(0,c.Z)(r,o,a,!1,null,"61315bde",null,!1,u,i),p=d.exports},38810:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var i,u={uIcon:n(38275).Z},o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"u-number-box"},[e.showMinus&&e.$slots.minus?n("v-uni-view",{staticClass:"u-number-box__slot",on:{touchstart:function(t){arguments[0]=t=e.$handleEvent(t),e.onTouchStart("minus")},touchend:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clearTimeout.apply(void 0,arguments)},click:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clickHandler("minus")}}},[e._t("minus")],2):e.showMinus?n("v-uni-view",{staticClass:"u-number-box__minus",class:{"u-number-box__minus--disabled":e.isDisabled("minus")},style:[e.buttonStyle("minus")],attrs:{"hover-class":"u-number-box__minus--hover","hover-stay-time":"150"},on:{touchstart:function(t){arguments[0]=t=e.$handleEvent(t),e.onTouchStart("minus")},touchend:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clearTimeout.apply(void 0,arguments)},click:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clickHandler("minus")}}},[n("u-icon",{attrs:{name:"minus",color:e.isDisabled("minus")?"#c8c9cc":"#323233",size:"15",bold:!0,customStyle:e.iconStyle}})],1):e._e(),e._t("input",[n("v-uni-input",{staticClass:"u-number-box__input",class:{"u-number-box__input--disabled":e.disabled||e.disabledInput},style:[e.inputStyle],attrs:{disabled:e.disabledInput||e.disabled,"cursor-spacing":e.getCursorSpacing,type:"number"},on:{blur:function(t){arguments[0]=t=e.$handleEvent(t),e.onBlur.apply(void 0,arguments)},focus:function(t){arguments[0]=t=e.$handleEvent(t),e.onFocus.apply(void 0,arguments)},input:function(t){arguments[0]=t=e.$handleEvent(t),e.onInput.apply(void 0,arguments)}},model:{value:e.currentValue,callback:function(t){e.currentValue=t},expression:"currentValue"}})]),e.showPlus&&e.$slots.plus?n("v-uni-view",{staticClass:"u-number-box__slot",on:{touchstart:function(t){arguments[0]=t=e.$handleEvent(t),e.onTouchStart("plus")},touchend:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clearTimeout.apply(void 0,arguments)},click:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clickHandler("plus")}}},[e._t("plus")],2):e.showPlus?n("v-uni-view",{staticClass:"u-number-box__plus",class:{"u-number-box__minus--disabled":e.isDisabled("plus")},style:[e.buttonStyle("plus")],attrs:{"hover-class":"u-number-box__plus--hover","hover-stay-time":"150"},on:{touchstart:function(t){arguments[0]=t=e.$handleEvent(t),e.onTouchStart("plus")},touchend:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clearTimeout.apply(void 0,arguments)},click:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t),e.clickHandler("plus")}}},[n("u-icon",{attrs:{name:"plus",color:e.isDisabled("plus")?"#c8c9cc":"#323233",size:"15",bold:!0,customStyle:e.iconStyle}})],1):e._e()],2)},a=[],l=n(41541),s=(n(57327),n(41539),n(74916),n(15306),n(82772),n(92222),n(47042),n(96647),n(39714),n(9653),{props:{name:{type:[String,Number],default:uni.$u.props.numberBox.name},value:{type:[String,Number],default:uni.$u.props.numberBox.value},min:{type:[String,Number],default:uni.$u.props.numberBox.min},max:{type:[String,Number],default:uni.$u.props.numberBox.max},step:{type:[String,Number],default:uni.$u.props.numberBox.step},integer:{type:Boolean,default:uni.$u.props.numberBox.integer},disabled:{type:Boolean,default:uni.$u.props.numberBox.disabled},disabledInput:{type:Boolean,default:uni.$u.props.numberBox.disabledInput},asyncChange:{type:Boolean,default:uni.$u.props.numberBox.asyncChange},inputWidth:{type:[String,Number],default:uni.$u.props.numberBox.inputWidth},showMinus:{type:Boolean,default:uni.$u.props.numberBox.showMinus},showPlus:{type:Boolean,default:uni.$u.props.numberBox.showPlus},decimalLength:{type:[String,Number,null],default:uni.$u.props.numberBox.decimalLength},longPress:{type:Boolean,default:uni.$u.props.numberBox.longPress},color:{type:String,default:uni.$u.props.numberBox.color},buttonSize:{type:[String,Number],default:uni.$u.props.numberBox.buttonSize},bgColor:{type:String,default:uni.$u.props.numberBox.bgColor},cursorSpacing:{type:[String,Number],default:uni.$u.props.numberBox.cursorSpacing},disablePlus:{type:Boolean,default:uni.$u.props.numberBox.disablePlus},disableMinus:{type:Boolean,default:uni.$u.props.numberBox.disableMinus},iconStyle:{type:[Object,String],default:uni.$u.props.numberBox.iconStyle}}}),r={name:"u-number-box",mixins:[uni.$u.mpMixin,uni.$u.mixin,s],data:function(){return{currentValue:"",longPressTimer:null}},watch:{watchChange:function(e){this.check()},value:function(e){e!==this.currentValue&&(this.currentValue=this.format(this.value))}},computed:{getCursorSpacing:function(){return uni.$u.getPx(this.cursorSpacing)},buttonStyle:function(){var e=this;return function(t){var n={backgroundColor:e.bgColor,height:uni.$u.addUnit(e.buttonSize),color:e.color};return e.isDisabled(t)&&(n.backgroundColor="#f7f8fa"),n}},inputStyle:function(){this.disabled||this.disabledInput;var e={color:this.color,backgroundColor:this.bgColor,height:uni.$u.addUnit(this.buttonSize),width:uni.$u.addUnit(this.inputWidth)};return e},watchChange:function(){return[this.integer,this.decimalLength,this.min,this.max]},isDisabled:function(){var e=this;return function(t){return"plus"===t?e.disabled||e.disablePlus||e.currentValue>=e.max:e.disabled||e.disableMinus||e.currentValue<=e.min}}},mounted:function(){this.init()},methods:{init:function(){this.currentValue=this.format(this.value)},format:function(e){return e=this.filter(e),e=""===e?0:+e,e=Math.max(Math.min(this.max,e),this.min),null!==this.decimalLength&&(e=e.toFixed(this.decimalLength)),e},filter:function(e){return e=String(e).replace(/[^0-9.-]/g,""),this.integer&&-1!==e.indexOf(".")&&(e=e.split(".")[0]),e},check:function(){var e=this.format(this.currentValue);e!==this.currentValue&&(this.currentValue=e)},onFocus:function(e){this.$emit("focus",(0,l.Z)((0,l.Z)({},e.detail),{},{name:this.name}))},onBlur:function(e){this.format(e.detail.value);this.$emit("blur",(0,l.Z)((0,l.Z)({},e.detail),{},{name:this.name}))},onInput:function(e){var t=e.detail||{},n=t.value,i=void 0===n?"":n;if(""!==i){var u=this.filter(i);if(null!==this.decimalLength&&-1!==u.indexOf(".")){var o=u.split(".");u="".concat(o[0],".").concat(o[1].slice(0,this.decimalLength))}u=this.format(u),this.emitChange(u)}},emitChange:function(e){var t=this;this.asyncChange||this.$nextTick((function(){t.$emit("input",e),t.currentValue=e,t.$forceUpdate()})),this.$emit("change",{value:e,name:this.name})},onChange:function(){var e=this.type;if(this.isDisabled(e))return this.$emit("overlimit",e);var t="minus"===e?-this.step:+this.step,n=this.format(this.add(+this.currentValue,t));this.emitChange(n),this.$emit(e)},add:function(e,t){var n=Math.pow(10,10);return Math.round((e+t)*n)/n},clickHandler:function(e){this.type=e,this.onChange()},longPressStep:function(){var e=this;this.clearTimeout(),this.longPressTimer=setTimeout((function(){e.onChange(),e.longPressStep()}),250)},onTouchStart:function(e){var t=this;this.longPress&&(this.clearTimeout(),this.type=e,this.longPressTimer=setTimeout((function(){t.onChange(),t.longPressStep()}),600))},onTouchEnd:function(){this.longPress&&this.clearTimeout()},clearTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){clearTimeout(this.longPressTimer),this.longPressTimer=null}))}},c=r,d=(n(57439),n(69453)),p=(0,d.Z)(c,o,a,!1,null,"1f875ce7",null,!1,u,i),h=p.exports},90677:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var i,u={uCellGroup:n(45829).Z,uCell:n(4438).Z,uNumberBox:n(38810).Z,uIcon:n(38275).Z},o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{},[n("u-cell-group",{attrs:{border:!0}},[n("u-cell",{attrs:{border:!0,title:"基础用法"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1"},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value1,callback:function(t){e.value1=t},expression:"value1"}})],1),n("u-cell",{attrs:{border:!0,title:"步长设置"}},[n("u-number-box",{attrs:{slot:"right-icon",step:e.step1},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value2,callback:function(t){e.value2=t},expression:"value2"}})],1),n("u-cell",{attrs:{border:!0,title:"限制输入范围"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",min:e.min1,max:e.max1},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value3,callback:function(t){e.value3=t},expression:"value3"}})],1),n("u-cell",{attrs:{border:!0,title:"限制输入整数"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",integer:!0},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value4,callback:function(t){e.value4=t},expression:"value4"}})],1),n("u-cell",{attrs:{border:!0,title:"禁用状态"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",disabled:!0},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value5,callback:function(t){e.value5=t},expression:"value5"}})],1),n("u-cell",{attrs:{border:!0,title:"禁用输入框"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",disabledInput:!0},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value6,callback:function(t){e.value6=t},expression:"value6"}})],1),n("u-cell",{attrs:{border:!0,title:"禁用长按"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",longPress:!1},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value7,callback:function(t){e.value7=t},expression:"value7"}})],1),n("u-cell",{attrs:{border:!0,title:"固定小数位数"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"0.2",decimalLength:"1"},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value8,callback:function(t){e.value8=t},expression:"value8"}})],1),n("u-cell",{attrs:{border:!0,title:"异步变更"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",asyncChange:e.asyncChange},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.myAsyncChange.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value9,callback:function(t){e.value9=t},expression:"value9"}})],1),n("u-cell",{attrs:{border:!0,title:"自定义大小颜色样式"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",color:e.color,buttonSize:e.buttonSize,bgColor:e.bgColor,iconStyle:"color: #fff"},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.change.apply(void 0,arguments)}},slot:"right-icon",model:{value:e.value10,callback:function(t){e.value10=t},expression:"value10"}})],1),n("u-cell",{attrs:{border:!0,title:"自定义(为0时减少按钮会消失)"}},[n("u-number-box",{attrs:{slot:"right-icon",step:"1",min:0,showMinus:e.value11>0},slot:"right-icon",model:{value:e.value11,callback:function(t){e.value11=t},expression:"value11"}},[n("v-uni-view",{staticClass:"minus",attrs:{slot:"minus"},slot:"minus"},[n("u-icon",{attrs:{name:"minus",size:"12"}})],1),n("v-uni-text",{staticClass:"input",staticStyle:{width:"50px","text-align":"center"},attrs:{slot:"input"},slot:"input"},[e._v(e._s(e.value11))]),n("v-uni-view",{staticClass:"plus",attrs:{slot:"plus"},slot:"plus"},[n("u-icon",{attrs:{name:"plus",color:"#FFFFFF",size:"12"}})],1)],1)],1)],1)],1)},a=[],l={data:function(){return{value1:3,value2:3,value3:3,value4:3,value5:3,value6:3,value7:3,value8:3.1,value9:3,value10:3,value11:3,step1:2,min1:5,max1:8,asyncChange:!0,color:"#FFFFFF",buttonSize:36,bgColor:"#2979ff"}},methods:{change:function(e){console.log("change",e)},myAsyncChange:function(e){var t=this;this.asyncChange=!1,uni.showLoading({title:"正在加载"}),setTimeout((function(){uni.hideLoading(),t.value9=e,t.asyncChange=!0}),3e3)}}},s=l,r=(n(50719),n(69453)),c=(0,r.Z)(s,o,a,!1,null,"b2db1842",null,!1,u,i),d=c.exports},21208:function(e,t,n){"use strict";n.r(t);var i=n(43481),u=n.n(i),o=n(2400),a=n.n(o),l=a()(u());l.push([e.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */uni-view[data-v-61315bde], uni-scroll-view[data-v-61315bde], uni-swiper-item[data-v-61315bde]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.u-cell-group[data-v-61315bde]{flex:1}.u-cell-group__title[data-v-61315bde]{padding:16px 16px 8px}.u-cell-group__title__text[data-v-61315bde]{font-size:15px;line-height:16px;color:#303133}.u-cell-group__wrapper[data-v-61315bde]{position:relative}',""]),t["default"]=l},870:function(e,t,n){"use strict";n.r(t);var i=n(43481),u=n.n(i),o=n(2400),a=n.n(o),l=a()(u());l.push([e.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */uni-view[data-v-1f875ce7], uni-scroll-view[data-v-1f875ce7], uni-swiper-item[data-v-1f875ce7]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.u-number-box[data-v-1f875ce7]{\ndisplay:flex;\nflex-direction:row;align-items:center}.u-number-box__slot[data-v-1f875ce7]{touch-action:none}.u-number-box__plus[data-v-1f875ce7], .u-number-box__minus[data-v-1f875ce7]{width:35px;\ndisplay:flex;\nflex-direction:row;justify-content:center;align-items:center;touch-action:none}.u-number-box__plus--hover[data-v-1f875ce7], .u-number-box__minus--hover[data-v-1f875ce7]{background-color:#e6e6e6!important}.u-number-box__plus--disabled[data-v-1f875ce7], .u-number-box__minus--disabled[data-v-1f875ce7]{color:#c8c9cc;background-color:#f7f8fa}.u-number-box__plus[data-v-1f875ce7]{border-top-right-radius:4px;border-bottom-right-radius:4px}.u-number-box__minus[data-v-1f875ce7]{border-top-left-radius:4px;border-bottom-left-radius:4px}.u-number-box__input[data-v-1f875ce7]{position:relative;text-align:center;font-size:15px;padding:0;margin:0 2px;\ndisplay:flex;\nflex-direction:row;align-items:center;justify-content:center}.u-number-box__input--disabled[data-v-1f875ce7]{color:#c8c9cc;background-color:#f2f3f5}',""]),t["default"]=l},48174:function(e,t,n){"use strict";n.r(t);var i=n(43481),u=n.n(i),o=n(2400),a=n.n(o),l=a()(u());l.push([e.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */.minus[data-v-b2db1842]{width:22px;height:22px;border-width:1px;border-color:#e6e6e6;border-top-left-radius:100px;border-top-right-radius:100px;border-bottom-left-radius:100px;border-bottom-right-radius:100px;display:flex;flex-direction:row;justify-content:center;align-items:center}.input[data-v-b2db1842]{padding:0 10px}.plus[data-v-b2db1842]{width:22px;height:22px;background-color:red;border-radius:50%;display:flex;justify-content:center;align-items:center}',""]),t["default"]=l}}]);