修改echart引入方式

This commit is contained in:
MTrunning
2020-07-27 21:06:04 +08:00
parent f032e25cdc
commit dacd429fea
9 changed files with 30 additions and 15 deletions
@@ -6,7 +6,6 @@
<script>
import echartMixins from "@/utils/resizeMixins";
const echarts = require("echarts");
export default {
data() {
return {
@@ -20,7 +19,7 @@ export default {
methods: {
draw() {
// 基于准备好的dom,初始化echarts实例
this.chart = echarts.init(document.getElementById("bottomLeftChart"));
this.chart = this.$echarts.init(document.getElementById("bottomLeftChart"));
// ----------------------------------------------------------------
let category = [
"市区",
@@ -227,7 +226,7 @@ export default {
itemStyle: {
normal: {
barBorderRadius: 5,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#956FD4" },
{ offset: 1, color: "#3EACE5" }
])
@@ -244,7 +243,7 @@ export default {
itemStyle: {
normal: {
barBorderRadius: 5,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "rgba(156,107,211,0.8)" },
{ offset: 0.2, color: "rgba(156,107,211,0.5)" },
{ offset: 1, color: "rgba(156,107,211,0.2)" }
@@ -6,7 +6,7 @@
<script>
import echartMixins from "@/utils/resizeMixins";
const echarts = require("echarts");
export default {
data() {
return {
@@ -26,7 +26,7 @@ export default {
},
draw() {
// 基于准备好的dom,初始化echarts实例
this.chart = echarts.init(document.getElementById("bottomRightChart"));
this.chart = this.$echarts.init(document.getElementById("bottomRightChart"));
// ----------------------------------------------------------------
// 数据
let dateBase = new Date();
@@ -6,7 +6,7 @@
<script>
import echartMixins from "@/utils/resizeMixins";
const echarts = require("echarts");
export default {
data() {
return {
@@ -47,7 +47,7 @@ export default {
methods: {
draw() {
// 基于准备好的dom,初始化echarts实例
this.chart = echarts.init(document.getElementById(this.id));
this.chart = this.$echarts.init(document.getElementById(this.id));
// ----------------------------------------------------------------
let tips = this.tips;
let option = {
@@ -6,7 +6,7 @@
<script>
import echartMixins from "@/utils/resizeMixins";
const echarts = require("echarts");
export default {
data() {
return {
@@ -20,7 +20,7 @@ export default {
methods: {
draw() {
// 基于准备好的dom,初始化echarts实例
this.chart = echarts.init(document.getElementById("centreLeft1Chart"));
this.chart = this.$echarts.init(document.getElementById("centreLeft1Chart"));
// ----------------------------------------------------------------
this.chart.setOption({
@@ -6,7 +6,7 @@
<script>
import echartMixins from "@/utils/resizeMixins";
const echarts = require("echarts");
export default {
data() {
return {
@@ -20,7 +20,7 @@ export default {
methods: {
draw() {
// 基于准备好的dom,初始化echarts实例
this.chart = echarts.init(document.getElementById("centreLeft2Chart"));
this.chart = this.$echarts.init(document.getElementById("centreLeft2Chart"));
// ----------------------------------------------------------------
let option = {
@@ -6,7 +6,7 @@
<script>
import echartMixins from "@/utils/resizeMixins";
const echarts = require("echarts");
export default {
data() {
return {
@@ -20,7 +20,7 @@ export default {
methods: {
draw() {
// 基于准备好的dom,初始化echarts实例
this.chart = echarts.init(document.getElementById("centreRight2Chart1"));
this.chart = this.$echarts.init(document.getElementById("centreRight2Chart1"));
// ----------------------------------------------------------------
let dataBJ = [
[94, 69, 114, 2.08, 73, 39, 22],
+5
View File
@@ -22,6 +22,11 @@ import '@/common/flexible.js';
// 引入全局css
import './assets/scss/style.scss';
//引入echart
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
Vue.config.productionTip = false;
new Vue({