Commit fa5598fa authored by leon's avatar leon

feat: add function px change to rpx

parent c63d4d40
<template> <template>
<view> <view>
<uni-ec-canvas class="uni-ec-canvas" id="dashboard-progress" ref="dashboardProgressCanvas" <uni-ec-canvas
canvas-id="dashboard-progress-chart" :ec="ec"></uni-ec-canvas> class="uni-ec-canvas"
id="dashboard-progress"
ref="dashboardProgressCanvas"
canvas-id="dashboard-progress-chart"
:ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas>
</view> </view>
</template> </template>
...@@ -51,7 +57,7 @@ ...@@ -51,7 +57,7 @@
], ],
[1, this.elementInfo.option.progress.trailColor] [1, this.elementInfo.option.progress.trailColor]
] ]
const strokeWidth = this.elementInfo.option.progress.strokeWidth const strokeWidth = this.$u.common.pxToRpx(this.elementInfo.option.progress.strokeWidth)
var startAngle = 180 var startAngle = 180
var endAngle = 0 var endAngle = 0
switch (this.elementInfo.option.progress.gapPosition) { switch (this.elementInfo.option.progress.gapPosition) {
...@@ -132,7 +138,6 @@ ...@@ -132,7 +138,6 @@
}, },
radius: '90%', radius: '90%',
// data: guageChart
}] }]
} }
chart.setOption(options) chart.setOption(options)
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
<view class="u-progress-text">{{elementInfo.data.dataList.endVal}}%</view> <view class="u-progress-text">{{elementInfo.data.dataList.endVal}}%</view>
</u-circle-progress> </u-circle-progress>
<DashboardProgress v-if="elementInfo.option.progress.type === 'dashboard'" :elementInfo="elementInfo"></DashboardProgress> <DashboardProgress v-if="elementInfo.option.progress.type === 'dashboard'" :elementInfo="elementInfo"></DashboardProgress>
</view> </view>
</template> </template>
......
...@@ -44,11 +44,24 @@ const install = (Vue, vm) => { ...@@ -44,11 +44,24 @@ const install = (Vue, vm) => {
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// return year + "-" + month + "-" + day; // return year + "-" + month + "-" + day;
} }
// px转换为rpx
const pxToRpx = (value) => {
return value / uni.getSystemInfoSync().windowWidth * 750
}
// rpx转换为px
const rpxToPx = (value) => {
return value / 750 * uni.getSystemInfoSync().windowWidth
}
vm.$u.common = { vm.$u.common = {
converFunction, converFunction,
fillDigit, fillDigit,
toThousands, toThousands,
dateFormat dateFormat,
pxToRpx,
rpxToPx
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment