Showing
3 changed files
with
19 additions
and
5 deletions
| @@ -6,7 +6,7 @@ Component({ | @@ -6,7 +6,7 @@ Component({ | ||
| 6 | properties: { | 6 | properties: { |
| 7 | stat: { | 7 | stat: { |
| 8 | type: String, | 8 | type: String, |
| 9 | - value:"4.0", | 9 | + value:"4.5", |
| 10 | }, | 10 | }, |
| 11 | color:{ | 11 | color:{ |
| 12 | type:String, | 12 | type:String, |
| @@ -22,8 +22,22 @@ Component({ | @@ -22,8 +22,22 @@ Component({ | ||
| 22 | /** | 22 | /** |
| 23 | * 组件的初始数据 | 23 | * 组件的初始数据 |
| 24 | */ | 24 | */ |
| 25 | - data: {}, | ||
| 26 | - | 25 | + data: { |
| 26 | + statnum:90.21 | ||
| 27 | + }, | ||
| 28 | + observers: { | ||
| 29 | + 'stat': function (stat) { | ||
| 30 | + console.log('stat...',stat) | ||
| 31 | + stat=parseFloat(stat) | ||
| 32 | + let statnum=0; | ||
| 33 | + statnum=(stat/5) | ||
| 34 | + let px=(parseInt(stat)-1)*0.00070 //(5/(84*84)) | ||
| 35 | + statnum=(statnum+px)*100 | ||
| 36 | + this.setData({ | ||
| 37 | + statnum:statnum, | ||
| 38 | + }) | ||
| 39 | + } | ||
| 40 | + }, | ||
| 27 | /** | 41 | /** |
| 28 | * 组件的方法列表 | 42 | * 组件的方法列表 |
| 29 | */ | 43 | */ |
| 1 | <!--components/stat/stat.wxml--> | 1 | <!--components/stat/stat.wxml--> |
| 2 | <view class="flex-ll"> | 2 | <view class="flex-ll"> |
| 3 | <view class="stat"> | 3 | <view class="stat"> |
| 4 | - <view class="bg" style="background-color: {{$color}};width: {{(stat/5)*100}}%"></view> | 4 | + <view class="bg" style="background-color: {{color}};width: {{statnum}}%"></view> |
| 5 | <image src="http://qn.colorcun.com/custom/lite-online/image/%E9%95%82%E7%A9%BA%E6%98%9F%E6%98%9F.png"></image> | 5 | <image src="http://qn.colorcun.com/custom/lite-online/image/%E9%95%82%E7%A9%BA%E6%98%9F%E6%98%9F.png"></image> |
| 6 | </view> | 6 | </view> |
| 7 | <view class="stat-text" wx:if="{{hasShowText}}">{{stat}} 分</view> | 7 | <view class="stat-text" wx:if="{{hasShowText}}">{{stat}} 分</view> |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | "nodeModules": true | 9 | "nodeModules": true |
| 10 | }, | 10 | }, |
| 11 | "compileType": "miniprogram", | 11 | "compileType": "miniprogram", |
| 12 | - "libVersion": "2.4.2", | 12 | + "libVersion": "2.6.1", |
| 13 | "appid": "wxd3dc4206c76f14fc", | 13 | "appid": "wxd3dc4206c76f14fc", |
| 14 | "projectname": "xcx-book", | 14 | "projectname": "xcx-book", |
| 15 | "isGameTourist": false, | 15 | "isGameTourist": false, |
-
Please register or login to post a comment