update echarts挂载全局
This commit is contained in:
parent
c294262cda
commit
c2e661b1a8
@ -10,6 +10,7 @@ import '@/assets/scss/index.scss'
|
|||||||
import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
|
import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
|
||||||
import { isAuth } from '@/utils'
|
import { isAuth } from '@/utils'
|
||||||
// import cloneDeep from 'lodash/cloneDeep'
|
// import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
import echarts from 'echarts'
|
||||||
|
|
||||||
Vue.use(VueCookie)
|
Vue.use(VueCookie)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
@ -20,6 +21,7 @@ Vue.config.productionTip = false
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 挂载全局
|
// 挂载全局
|
||||||
|
Vue.prototype.$echarts = echarts // echarts画图
|
||||||
Vue.prototype.$http = httpRequest // ajax请求方法
|
Vue.prototype.$http = httpRequest // ajax请求方法
|
||||||
Vue.prototype.isAuth = isAuth // 权限方法
|
Vue.prototype.isAuth = isAuth // 权限方法
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -18,7 +16,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleDrawLine () {
|
handleDrawLine () {
|
||||||
let myChart = echarts.init(document.getElementById('myChart'))
|
let myChart = this.$echarts.init(document.getElementById('myChart'))
|
||||||
// 绘制图表
|
// 绘制图表
|
||||||
myChart.setOption({
|
myChart.setOption({
|
||||||
title: { text: '在Vue中使用echarts' },
|
title: { text: '在Vue中使用echarts' },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user