修改echart引入方式
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
| 文件 | 作用/功能 |
|
| 文件 | 作用/功能 |
|
||||||
| ------------------- | --------------------------------------------------- |
|
| ------------------- | --------------------------------------------------- |
|
||||||
| main.js | 主目录文件,全局引入了引入 vue-awesome |
|
| main.js | 主目录文件,引入Echart/DataV等文件 |
|
||||||
| utils | 工具函数与 mixins 函数等 |
|
| utils | 工具函数与 mixins 函数等 |
|
||||||
| views/ index.vue | 项目主结构 |
|
| views/ index.vue | 项目主结构 |
|
||||||
| views/其余文件 | 界面各个区域组件(按照位置来命名)ajax 接口请求位置 |
|
| views/其余文件 | 界面各个区域组件(按照位置来命名)ajax 接口请求位置 |
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echartMixins from "@/utils/resizeMixins";
|
import echartMixins from "@/utils/resizeMixins";
|
||||||
const echarts = require("echarts");
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -20,7 +19,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
draw() {
|
draw() {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
// 基于准备好的dom,初始化echarts实例
|
||||||
this.chart = echarts.init(document.getElementById("bottomLeftChart"));
|
this.chart = this.$echarts.init(document.getElementById("bottomLeftChart"));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
let category = [
|
let category = [
|
||||||
"市区",
|
"市区",
|
||||||
@@ -227,7 +226,7 @@ export default {
|
|||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
barBorderRadius: 5,
|
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: 0, color: "#956FD4" },
|
||||||
{ offset: 1, color: "#3EACE5" }
|
{ offset: 1, color: "#3EACE5" }
|
||||||
])
|
])
|
||||||
@@ -244,7 +243,7 @@ export default {
|
|||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
barBorderRadius: 5,
|
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, color: "rgba(156,107,211,0.8)" },
|
||||||
{ offset: 0.2, color: "rgba(156,107,211,0.5)" },
|
{ offset: 0.2, color: "rgba(156,107,211,0.5)" },
|
||||||
{ offset: 1, color: "rgba(156,107,211,0.2)" }
|
{ offset: 1, color: "rgba(156,107,211,0.2)" }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echartMixins from "@/utils/resizeMixins";
|
import echartMixins from "@/utils/resizeMixins";
|
||||||
const echarts = require("echarts");
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -26,7 +26,7 @@ export default {
|
|||||||
},
|
},
|
||||||
draw() {
|
draw() {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
// 基于准备好的dom,初始化echarts实例
|
||||||
this.chart = echarts.init(document.getElementById("bottomRightChart"));
|
this.chart = this.$echarts.init(document.getElementById("bottomRightChart"));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// 数据
|
// 数据
|
||||||
let dateBase = new Date();
|
let dateBase = new Date();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echartMixins from "@/utils/resizeMixins";
|
import echartMixins from "@/utils/resizeMixins";
|
||||||
const echarts = require("echarts");
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -47,7 +47,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
draw() {
|
draw() {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
// 基于准备好的dom,初始化echarts实例
|
||||||
this.chart = echarts.init(document.getElementById(this.id));
|
this.chart = this.$echarts.init(document.getElementById(this.id));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
let tips = this.tips;
|
let tips = this.tips;
|
||||||
let option = {
|
let option = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echartMixins from "@/utils/resizeMixins";
|
import echartMixins from "@/utils/resizeMixins";
|
||||||
const echarts = require("echarts");
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -20,7 +20,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
draw() {
|
draw() {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
// 基于准备好的dom,初始化echarts实例
|
||||||
this.chart = echarts.init(document.getElementById("centreLeft1Chart"));
|
this.chart = this.$echarts.init(document.getElementById("centreLeft1Chart"));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echartMixins from "@/utils/resizeMixins";
|
import echartMixins from "@/utils/resizeMixins";
|
||||||
const echarts = require("echarts");
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -20,7 +20,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
draw() {
|
draw() {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
// 基于准备好的dom,初始化echarts实例
|
||||||
this.chart = echarts.init(document.getElementById("centreLeft2Chart"));
|
this.chart = this.$echarts.init(document.getElementById("centreLeft2Chart"));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
let option = {
|
let option = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echartMixins from "@/utils/resizeMixins";
|
import echartMixins from "@/utils/resizeMixins";
|
||||||
const echarts = require("echarts");
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -20,7 +20,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
draw() {
|
draw() {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
// 基于准备好的dom,初始化echarts实例
|
||||||
this.chart = echarts.init(document.getElementById("centreRight2Chart1"));
|
this.chart = this.$echarts.init(document.getElementById("centreRight2Chart1"));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
let dataBJ = [
|
let dataBJ = [
|
||||||
[94, 69, 114, 2.08, 73, 39, 22],
|
[94, 69, 114, 2.08, 73, 39, 22],
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ import '@/common/flexible.js';
|
|||||||
// 引入全局css
|
// 引入全局css
|
||||||
import './assets/scss/style.scss';
|
import './assets/scss/style.scss';
|
||||||
|
|
||||||
|
|
||||||
|
//引入echart
|
||||||
|
import echarts from 'echarts'
|
||||||
|
Vue.prototype.$echarts = echarts
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
const path = require('path')
|
||||||
|
const resolve = dir => {
|
||||||
|
return path.join(__dirname, dir)
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
publicPath: './',
|
||||||
|
chainWebpack: config => {
|
||||||
|
config.resolve.alias
|
||||||
|
.set('_c', resolve('src/components')) // key,value自行定义,比如.set('@@', resolve('src/components'))
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user