Commit fa5598fa authored by leon's avatar leon

feat: add function px change to rpx

parent c63d4d40
<template>
<view>
<uni-ec-canvas class="uni-ec-canvas" id="dashboard-progress" ref="dashboardProgressCanvas"
canvas-id="dashboard-progress-chart" :ec="ec"></uni-ec-canvas>
<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>
</template>
......@@ -51,7 +57,7 @@
],
[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 endAngle = 0
switch (this.elementInfo.option.progress.gapPosition) {
......@@ -132,7 +138,6 @@
},
radius: '90%',
// data: guageChart
}]
}
chart.setOption(options)
......
......@@ -23,7 +23,6 @@
<view class="u-progress-text">{{elementInfo.data.dataList.endVal}}%</view>
</u-circle-progress>
<DashboardProgress v-if="elementInfo.option.progress.type === 'dashboard'" :elementInfo="elementInfo"></DashboardProgress>
</view>
</template>
......
......@@ -44,11 +44,24 @@ const install = (Vue, vm) => {
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 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 = {
converFunction,
fillDigit,
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