crm_second_opening_mini/uview-ui/components/u-rate/u-rate.js

11 lines
4.1 KiB
JavaScript
Raw Normal View History

2023-03-13 01:13:08 +00:00
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uview-ui/components/u-rate/u-rate"],{"152d":function(t,e,i){"use strict";var n=i("1dc3"),a=i.n(n);a.a},"1dc3":function(t,e,i){},"1e77":function(t,e,i){"use strict";i.r(e);var n=i("c741"),a=i.n(n);for(var u in n)["default"].indexOf(u)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(u);e["default"]=a.a},"71b2":function(t,e,i){"use strict";i.r(e);var n=i("c5ba"),a=i("1e77");for(var u in a)["default"].indexOf(u)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(u);i("152d");var c=i("f0c5"),r=Object(c["a"])(a["default"],n["b"],n["c"],!1,null,"d628c3b2",null,!1,n["a"],void 0);e["default"]=r.exports},c5ba:function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return u})),i.d(e,"a",(function(){return n}));var n={uIcon:function(){return i.e("uview-ui/components/u-icon/u-icon").then(i.bind(null,"3ff7"))}},a=function(){var t=this,e=t.$createElement,i=(t._self._c,t.__map(t.count,(function(e,i){var n=t.__get_orig(e),a={fontSize:t.size+"rpx",padding:"0 "+t.gutter/2+"rpx"},u=t.showDecimalIcon(i);return{$orig:n,a0:a,m0:u}})));t.$mp.data=Object.assign({},{$root:{l0:i}})},u=[]},c741:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={name:"u-rate",props:{value:{type:[Number,String],default:-1},count:{type:[Number,String],default:5},current:{type:[Number,String],default:0},disabled:{type:Boolean,default:!1},size:{type:[Number,String],default:32},inactiveColor:{type:String,default:"#b2b2b2"},activeColor:{type:String,default:"#FA3534"},gutter:{type:[Number,String],default:10},minCount:{type:[Number,String],default:0},allowHalf:{type:Boolean,default:!1},activeIcon:{type:String,default:"star-fill"},inactiveIcon:{type:String,default:"star"},customPrefix:{type:String,default:"uicon"},colors:{type:Array,default:function(){return[]}},icons:{type:Array,default:function(){return[]}}},data:function(){return{elId:this.$u.guid(),elClass:this.$u.guid(),starBoxLeft:0,activeIndex:-1!=this.value?this.value:this.current,starWidth:0,starWidthArr:[]}},watch:{current:function(t){this.activeIndex=t},value:function(t){this.activeIndex=t}},computed:{decimal:function(){return this.disabled?100*this.activeIndex%100:this.allowHalf?50:void 0},elActiveIcon:function(){var t=this.icons.length;if(t&&t<=this.count){var e=Math.round(this.activeIndex/Math.round(this.count/t));return e<1?this.icons[0]:e>t?this.icons[t-1]:this.icons[e-1]}return this.activeIcon},elActiveColor:function(){var t=this.colors.length;if(t&&t<=this.count){var e=Math.round(this.activeIndex/Math.round(this.count/t));return e<1?this.colors[0]:e>t?this.colors[t-1]:this.colors[e-1]}return this.activeColor}},methods:{getElRectById:function(){var t=this;this.$uGetRect("#"+this.elId).then((function(e){t.starBoxLeft=e.left}))},getElRectByClass:function(){var t=this;this.$uGetRect("."+this.elClass).then((function(e){t.starWidth=e.width;for(var i=0;i<t.count;i++)t.starWidthArr[i]=(i+1)*t.starWidth}))},touchMove:function(t){if(!this.disabled&&t.changedTouches[0]){var e=t.changedTouches[0].pageX,i=e-this.starBoxLeft;i<=0&&(this.activeIndex=0);var n=Math.ceil(i/this.starWidth);this.activeIndex=n>this.count?this.count:n,this.activeIndex<this.minCount&&(this.activeIndex=this.minCount),this.emitEvent()}},click:function(t,e){this.disabled||(this.allowHalf,1==t?1==this.activeIndex?this.activeIndex=0:this.activeIndex=1:this.activeIndex=t,this.activeIndex<this.minCount&&(this.activeIndex=this.minCount),this.emitEvent())},emitEvent:function(){this.$emit("change",this.activeIndex),-1!=this.value&&this.$emit("input",this.activeIndex)},showDecimalIcon:function(t){return this.disabled&&parseInt(this.activeIndex)===t}},mounted:function(){this.getElRectById(),this.getElRectByClass()}};e.default=n}}]);
;(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__("71b2"))
})
},
[['uview-ui/components/u-rate/u-rate-create-component']]
]);