Commit 3b804148 by sunchao

图表不显示bug修复

parent 097b1b1f
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"type" : "uniCloud" "type" : "uniCloud"
}, },
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
} }
] ]
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
.personalInfo { .personalInfo {
background: #fff; background: #fff;
width: 95%; width: 95%;
margin: 6rpx auto 0; margin: 20rpx auto 0;
.ulBox { .ulBox {
padding: 0 30rpx; padding: 0 30rpx;
......
...@@ -103,7 +103,8 @@ ...@@ -103,7 +103,8 @@
<view class="title"><view>测算结果及建议</view></view> <view class="title"><view>测算结果及建议</view></view>
<!-- 图表 --> <!-- 图表 -->
<!-- 为 ECharts 准备一个定义了宽高的 DOM --> <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<view id="main" style="width:96vw;height:400px" v-if="resultInfo"></view> <!-- <view id="main" style="width:96vw;height:400px" v-if="resultInfo"></view> -->
<l-echart ref="chart" @finished="init" v-if="resultInfo"></l-echart>
<view class="summaryContent" v-if="resultInfo"> <view class="summaryContent" v-if="resultInfo">
<view class="successInfo" v-if="resultInfo.code=='B001'"> <view class="successInfo" v-if="resultInfo.code=='B001'">
<strong>恭喜您!</strong> <strong>恭喜您!</strong>
...@@ -165,7 +166,8 @@ ...@@ -165,7 +166,8 @@
import api from "../../api/api"; import api from "../../api/api";
import common from "../../common/common"; import common from "../../common/common";
import dataHandling from "../../util/dataHandling"; import dataHandling from "../../util/dataHandling";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
export default { export default {
data() { data() {
...@@ -196,9 +198,15 @@ import { nanoid } from "nanoid"; ...@@ -196,9 +198,15 @@ import { nanoid } from "nanoid";
dataTree: [], dataTree: [],
schoolingLists:eduGradeLists, schoolingLists:eduGradeLists,
flatEduGradeLists:[], flatEduGradeLists:[],
option:{}
} }
}, },
methods: { methods: {
init() {
this.$refs.chart.init(echarts, chart => {
chart.setOption(this.option);
});
},
getEducationNo(val){ getEducationNo(val){
if(val){ if(val){
return this.flatEduGradeLists.filter(item=>item.value==val)[0].educationNo; return this.flatEduGradeLists.filter(item=>item.value==val)[0].educationNo;
...@@ -258,9 +266,9 @@ import { nanoid } from "nanoid"; ...@@ -258,9 +266,9 @@ import { nanoid } from "nanoid";
}, },
drawLine(){ drawLine(){
// 基于准备好的dom,初始化echarts实例 // 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main')); // var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据 // 指定图表的配置项和数据
var option = { this.option = {
title: {}, title: {},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
...@@ -338,7 +346,10 @@ import { nanoid } from "nanoid"; ...@@ -338,7 +346,10 @@ import { nanoid } from "nanoid";
}; };
// 使用刚指定的配置项和数据显示图表。 // 使用刚指定的配置项和数据显示图表。
myChart.setOption(option); // myChart.setOption(option);
this.$refs.chart.init(echarts, chart => {
chart.setOption(this.option);
});
}, },
settingYBY(item){ settingYBY(item){
// 逐年设定 // 逐年设定
...@@ -504,7 +515,8 @@ import { nanoid } from "nanoid"; ...@@ -504,7 +515,8 @@ import { nanoid } from "nanoid";
}, },
components:{ components:{
commonHead, commonHead,
foot foot,
LEchart
} }
} }
</script> </script>
......
...@@ -142,8 +142,8 @@ ...@@ -142,8 +142,8 @@
</view> </view>
</form> </form>
<!--测算结果-- v-show="resultFlag"--> <!--测算结果-- v-show="resultFlag"-->
<!-- <view class="result_wrapper" v-if="resultFlag"> --> <view class="result_wrapper" v-if="resultFlag">
<view class="result_wrapper"> <!-- <view class="result_wrapper"> -->
<view class="suggestInfo"> <view class="suggestInfo">
<view class="title"> <view class="title">
<view> <view>
...@@ -160,10 +160,10 @@ ...@@ -160,10 +160,10 @@
</label> </label>
</radio-group> </radio-group>
</view> </view>
<view style="height: 450rpx;width: 500rpx;border: 1rpx solid #c3c1c1;"> <!-- <view style="height: 450rpx;width: 500rpx;border: 1rpx solid #c3c1c1;"> -->
<!-- <view id="myEcharts"></view> --> <!-- <view id="myEcharts"></view> -->
<l-echart ref="chart" @finished="init"></l-echart> <l-echart ref="chart" @finished="init"></l-echart>
</view> <!-- </view> -->
<!-- <view class="linechart"> <!-- <view class="linechart">
<Echarts ref="echart" :option="option" style="height: 300px;"></Echarts> <Echarts ref="echart" :option="option" style="height: 300px;"></Echarts>
</view> --> </view> -->
...@@ -842,7 +842,7 @@ ...@@ -842,7 +842,7 @@
padding: 10rpx 0; padding: 10rpx 0;
margin-left: -10rpx; margin-left: -10rpx;
image{ image{
position: absolute; position: absolute!important;
right: 0; right: 0;
max-width: 17%; max-width: 17%;
top: 3%; top: 3%;
......
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