在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML5  HTML/ vue按需引用echarts出錯(cuò)

vue按需引用echarts出錯(cuò)

項(xiàng)目中echarts插件, 用npm安裝好后,全局引用的方式可以實(shí)現(xiàn)效果圖,但是全局引入會(huì)將所有的echarts圖表打包,導(dǎo)致體積過(guò)大,所以我想按需引入,但是在按需引用的過(guò)程中,一直報(bào)如下錯(cuò)誤,還請(qǐng)知道原因的大神們指導(dǎo)一下,告知一下為什么

<template>

<div class="container tob_system_mainpage">
    <div id="myChart" :style="{width: '300px', height: '300px'}"></div>
</div>

</template>
<style scoped>
</style>
<script>

// 引入基本模板
let echarts = require('echarts/lib/echarts')
// 引入柱狀圖組件
require('echarts/lib/chart/bar')
// 引入提示框和title組件
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
export default {
    data() {
        return {

        }
    },
    created() {},
    mounted() {
        this.drawLine();
        this.drawPie();
    },
    methods: {
        drawLine() {
            // 基于準(zhǔn)備好的dom,初始化echarts實(shí)例
            let myChart = echarts.init(document.getElementById('myChart'));
            // 繪制圖表
            myChart.setOption({
                title: { text: '在Vue中使用柱形圖echarts' },
                tooltip: {},
                xAxis: {
                    data: ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"]
                },
                yAxis: {},
                series: [{
                    name: '銷(xiāo)量',
                    type: 'bar',
                    data: [5, 20, 36, 10, 10, 20]
                }]
            });
        },
    },
}

</script>

前端頁(yè)面提示錯(cuò)誤如下圖所示:

clipboard.png

求指教

回答
編輯回答
夏木

this.$echarts這個(gè)你哪來(lái)的

2018年5月25日 09:51