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