12345678910 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uview-ui/components/u-rate/u-rate"],{1511:function(t,e,n){"use strict";(function(t){var i=n("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=i(n("2eee")),u=i(n("c973")),r=i(n("a29a")),o={name:"u-rate",mixins:[t.$u.mpMixin,t.$u.mixin,r.default],data:function(){return{elId:t.$u.guid(),elClass:t.$u.guid(),rateBoxLeft:0,activeIndex:this.value,rateWidth:0,moving:!1}},watch:{value:function(t){this.activeIndex=t},activeIndex:"emitEvent"},methods:{init:function(){var e=this;t.$u.sleep().then((function(){e.getRateItemRect(),e.getRateIconWrapRect()}))},getRateItemRect:function(){var e=this;return(0,u.default)(a.default.mark((function n(){return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$u.sleep();case 2:e.$uGetRect("#"+e.elId).then((function(t){e.rateBoxLeft=t.left}));case 3:case"end":return n.stop()}}),n)})))()},getRateIconWrapRect:function(){var t=this;this.$uGetRect("."+this.elClass).then((function(e){t.rateWidth=e.width}))},touchMove:function(t){if(this.touchable){this.preventEvent(t);var e=t.changedTouches[0].pageX;this.getActiveIndex(e)}},touchEnd:function(t){if(this.touchable){this.preventEvent(t);var e=t.changedTouches[0].pageX;this.getActiveIndex(e)}},clickHandler:function(e,n){if("ios"!==t.$u.os()||!this.moving){this.preventEvent(e);var i=0;i=e.changedTouches[0].pageX,this.getActiveIndex(i,!0)}},emitEvent:function(){this.$emit("change",this.activeIndex),this.$emit("input",this.activeIndex)},getActiveIndex:function(e){var n=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.disabled&&!this.readonly){var a=this.rateWidth*this.count+this.rateBoxLeft;e=t.$u.range(this.rateBoxLeft,a,e)-this.rateBoxLeft;var u,r=e;if(this.allowHalf){u=Math.floor(r/this.rateWidth);var o=r%this.rateWidth;o<=this.rateWidth/2&&o>0?u+=.5:o>this.rateWidth/2&&u++}else{u=Math.floor(r/this.rateWidth);var c=r%this.rateWidth;i?c>0&&u++:c>this.rateWidth/2&&u++}this.activeIndex=Math.min(u,this.count),this.activeIndex<this.minCount&&(this.activeIndex=this.minCount),setTimeout((function(){n.moving=!0}),10),setTimeout((function(){n.moving=!1}),10)}}},mounted:function(){this.init()}};e.default=o}).call(this,n("543d")["default"])},"21be":function(t,e,n){"use strict";var i=n("5859"),a=n.n(i);a.a},"529f":function(t,e,n){"use strict";n.r(e);var i=n("1511"),a=n.n(i);for(var u in i)["default"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(u);e["default"]=a.a},5859:function(t,e,n){},"9b05":function(t,e,n){"use strict";n.r(e);var i=n("d490"),a=n("529f");for(var u in a)["default"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(u);n("21be");var r,o=n("f0c5"),c=Object(o["a"])(a["default"],i["b"],i["c"],!1,null,"86143596",null,!1,i["a"],r);e["default"]=c.exports},d490:function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return u})),n.d(e,"a",(function(){return i}));var i={uIcon:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-icon/u-icon")]).then(n.bind(null,"01eb"))}},a=function(){var t=this,e=t.$createElement,n=(t._self._c,t.__get_style([t.$u.addStyle(t.customStyle)])),i=Math.floor(t.activeIndex),a=t.disabled?null:Math.floor(t.activeIndex),u=t.allowHalf?t.$u.addUnit(t.rateWidth/2):null,r=t.allowHalf?Math.ceil(t.activeIndex):null,o=t.allowHalf&&!t.disabled?Math.ceil(t.activeIndex):null,c=t.__map(Number(t.count),(function(e,n){var i=t.__get_orig(e),a={"padding-left":t.$u.addUnit(t.gutter/2),"padding-right":t.$u.addUnit(t.gutter/2)},u=t.allowHalf?{"padding-left":t.$u.addUnit(t.gutter/2),"padding-right":t.$u.addUnit(t.gutter/2)}:null;return{$orig:i,a0:a,a1:u}}));t._isMounted||(t.e0=function(e,n){var i=arguments[arguments.length-1].currentTarget.dataset,a=i.eventParams||i["event-params"];n=a.index;return e.stopPropagation(),t.clickHandler(e,n+1)},t.e1=function(e,n){var i=arguments[arguments.length-1].currentTarget.dataset,a=i.eventParams||i["event-params"];n=a.index;return e.stopPropagation(),t.clickHandler(e,n+1)}),t.$mp.data=Object.assign({},{$root:{s0:n,g0:i,g1:a,g2:u,g3:r,g4:o,l0:c}})},u=[]}}]);
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'uview-ui/components/u-rate/u-rate-create-component',
- {
- 'uview-ui/components/u-rate/u-rate-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('543d')['createComponent'](__webpack_require__("9b05"))
- })
- },
- [['uview-ui/components/u-rate/u-rate-create-component']]
- ]);
|