uniapp踩坑之项目:引入echarts可视化图表

在插件市场里导入项目里,echarts for uniapp - DCloud 插件市场 echarts适配uni-app,支持大部分平台,体验原汁原味echarts配置https://ext.dcloud.net.cn/plugin?id=8017


//在page.json里
"easycom": {
    "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
    "echarts": "@/components/echarts-uniapp/echarts-uniapp.vue"
},
//在单页面
<view class="container" style="height:400px;">
    <echarts ref="echarts" :option="option" canvasId="echarts"></echarts>
</view>

export default {
    data() {
        return {
            option: {}
        }
    },
    onReady() {
        this.option = {
            backgroundColor: "#ffffff",
            series: [{
                label: {
                    normal: {
                        fontSize: 14
                    }
                },
                type: 'pie',
                center: ['50%', '50%'],
                radius: ['0%', '40%'],
                data: [{
                    value: 55,
                    name: '北京'
                }, {
                    value: 20,
                    name: '武汉'
                }, {
                    value: 10,
                    name: '杭州'
                }, {
                    value: 20,
                    name: '广州'
                }, {
                    value: 38,
                    name: '上海'
                }]
            }]
        };
    }
}

上一篇文章, 

uniapp踩坑之项目:保存更新后跳转上一级页面并更新数据_意初的博客-CSDN博客_uniapp跳转上一级使用uni.navigateBack,并且用setTimeout来控制多久再跳转,方便让修改成功的通知出来后再执行跳转https://blog.csdn.net/weixin_43928112/article/details/128207172

猜你喜欢

转载自blog.csdn.net/weixin_43928112/article/details/128099639