Commit 74717060 authored by Jenny's avatar Jenny

feat: 进度条初始化修改

parent f46d5e05
...@@ -27,18 +27,20 @@ ...@@ -27,18 +27,20 @@
components: { components: {
uniEcCanvas uniEcCanvas
}, },
mounted() {
this.$refs['dashboardProgressCanvas'].init(this.inited)
},
methods: { methods: {
initChart() { inited(canvas, width, height, canvasDpr) {
this.$nextTick(() => {
this.$refs['dashboardProgressCanvas'].init((canvas, width, height, canvasDpr) => {
chart = this.$echarts.init(canvas, null, { chart = this.$echarts.init(canvas, null, {
width: width, width: width,
height: height, height: height,
devicePixelRatio: canvasDpr devicePixelRatio: canvasDpr
}) })
canvas.setChart(chart) canvas.setChart(chart)
const { endVal } = this.elementData.dataList let { endVal } = this.elementData.dataList
endVal = endVal || 0
const { width: pCanvasWidth, strokeColor, trailColor, titleColor, strokeWidth, gapPosition, gapDegree, strokeLinecap} = this.elementInfo.option.progress const { width: pCanvasWidth, strokeColor, trailColor, titleColor, strokeWidth, gapPosition, gapDegree, strokeLinecap} = this.elementInfo.option.progress
const guageChart = [{ const guageChart = [{
name: "", name: "",
...@@ -130,8 +132,9 @@ ...@@ -130,8 +132,9 @@
} }
chart.setOption(options) chart.setOption(options)
return chart return chart
}) },
}) initChart() {
this.$refs['dashboardProgressCanvas'].init(this.inited)
} }
} }
} }
......
<template> <template>
<view class="normal-table"> <view class="normal-table">
<NormalTitle :elementInfo="elementInfo"></NormalTitle> <NormalTitle :elementInfo="elementInfo"></NormalTitle>
<scroll-view v-if="chartTables.length" scroll-x="true" class="scroll-view_H"> <scroll-view scroll-x="true" class="scroll-view_H">
<view <view
class="table" class="table"
:style="[tableStyle]" :style="[tableStyle]"
> >
<view class="tr" v-if="elementInfo.table.tableHeader.showHeader"> <view class="tr" v-if="elementInfo.table.tableHeader.showHeader">
<view class="th" v-for="(item, index) in columns" :key="index" :style="[thStyle]">{{item.title}}</view> <view class="th" v-for="(item, index) in elementInfo.table.column" :key="index" :style="[thStyle]">{{item.title}}</view>
</view> </view>
<view class="tr" v-for="(cell, cellIndex) in chartTables" :key="cellIndex" @tap="cellClick(cell)"> <view class="tr" v-for="(cell, cellIndex) in chartTables" :key="cellIndex" @tap="cellClick(cell)">
<view class="td" :style="[tdStyle]" v-for="(item, index) in columns" :key="index"> <view class="td" :style="[tdStyle]" v-for="(item, index) in elementInfo.table.column" :key="index">
<template v-if="item.slots.customRender == 'rank'">{{index + 1}}</template> <template v-if="item.slots.customRender == 'rank'">{{index + 1}}</template>
<template v-else-if="item.slots.customRender == 'picture'"> <template v-else-if="item.slots.customRender == 'picture'">
<u-image <u-image
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
mixins: [echartElementData], mixins: [echartElementData],
data() { data() {
return { return {
columns: [],
chartTables: [], chartTables: [],
align: { align: {
left: 'start', left: 'start',
...@@ -55,7 +54,7 @@ ...@@ -55,7 +54,7 @@
const { frameStyle, frameWidth, frameColor, bordered } = this.elementInfo.table const { frameStyle, frameWidth, frameColor, bordered } = this.elementInfo.table
const { backgroundColor } = this.elementInfo.table.tableCell const { backgroundColor } = this.elementInfo.table.tableCell
return { return {
'width': `${240 * this.columns.length}rpx`, 'width': `${240 * this.elementInfo.table.column.length}rpx`,
'border-left': bordered ? `${frameStyle || 'solid'} ${frameWidth || 1}px ${frameColor || '#e4e7ed'}`: 'none', 'border-left': bordered ? `${frameStyle || 'solid'} ${frameWidth || 1}px ${frameColor || '#e4e7ed'}`: 'none',
'border-top': bordered ? `${frameStyle || 'solid'} ${frameWidth || 1}px ${frameColor || '#e4e7ed'}`: 'none', 'border-top': bordered ? `${frameStyle || 'solid'} ${frameWidth || 1}px ${frameColor || '#e4e7ed'}`: 'none',
'background-color': backgroundColor 'background-color': backgroundColor
...@@ -91,7 +90,6 @@ ...@@ -91,7 +90,6 @@
methods: { methods: {
initChart() { initChart() {
this.$nextTick(() => { this.$nextTick(() => {
this.columns = this.elementInfo.table.column
this.chartTables = this.elementData.dataList.chartTables this.chartTables = this.elementData.dataList.chartTables
}) })
}, },
......
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