日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

前端学习(2471):vue-echarts和echarts的区别:

發布時間:2023/12/10 vue 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 前端学习(2471):vue-echarts和echarts的区别: 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

vue-echarts和echarts的區別:

  • vue-echarts是封裝后的vue插件, 基于?ECharts?v4.0.1+ 開發,依賴?Vue.js?v2.2.6+,功能一樣的只是把它封裝成vue插件 這樣更方便以vue的方式去使用它。
  • echarts就是普通的js庫,

vue-echarts特征:

  • 輕量,高效,按需綁定事件
  • 支持按需導入ECharts.js圖表??和組件
  • 支持組件調整大小事件自動更新視圖

git地址:https://github.com/ecomfe/vue-echarts

安裝

npm(推薦方式)

$ npm install vue-echarts

bower

$ bower install vue-echarts

手動安裝

直接下載?dist/vue-echarts.js?并在 HTML 文件中引入:

<script src="path/to/vue-echarts/dist/vue-echarts.js"></script>

使用方法

用 npm 與 vue-loader 基于 ES Module 引入(推薦用法)

import Vue from 'vue' import ECharts from 'vue-echarts/components/ECharts.vue' // 手動引入 ECharts 各模塊來減小打包體積 import 'echarts/lib/chart/bar' import 'echarts/lib/component/tooltip' import 'echarts/lib/component/polar' import 'echarts/lib/component/legend' import 'echarts/lib/component/title.js' // 注冊組件后即可使用 Vue.component('v-chart', ECharts)

?

用 vue-cli 搭建的項目,打開 build 文件夾中的 webpack.base.conf.js 文件

1、webpack 1.x 修改成如下

{ test: /\.js$/, loader: 'babel', include: [path.join(prjRoot, 'src'),path.join(prjRoot, 'node_modules/vue-echarts-v3/src') ],exclude: /node_modules(?![\\/]vue-echarts-v3[\\/]src[\\/])/ },

?

2、webpack 2.x 修改成如下

{ test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test'), resolve('node_modules/vue-echarts-v3/src')] }

?

調用組件

<style>.echarts {width: 100%;height: 100%;} </style><template><v-chart theme="ovilia-green" :options="polar"/> </template><script> import ECharts from 'vue-echarts/components/ECharts' import theme from '../theme.json' ECharts.registerTheme('ovilia-green', theme); //引入主題 export default {components: {'v-chart': ECharts},data () {return {polar: {title : {text: '會員數據統計',subtext: '動態數據',x:'center'},tooltip : {trigger: 'item',formatter: "{a} <br/> : {c} (ozvdkddzhkzd%)"},legend: {show: true,orient: 'vertical',left: 'left',data: ['微信訪問','公眾號訪問','掃碼進入','分享進入','搜索訪問']},series : [{name: '訪問來源',type: 'pie',radius : '55%',center: ['50%', '60%'],data:[{value:335, name:'微信訪問'},{value:310, name:'公眾號訪問'},{value:234, name:'掃碼進入'},{value:135, name:'分享進入'},{value:1548, name:'搜索訪問'}],itemStyle: {emphasis: {shadowBlur: 10,shadowOffsetX: 0,shadowColor: 'rgba(0, 0, 0, 0.5)'}}}]}}} } </script>

?

?

自定義主題

只要把定義主題樣式theme.json文件通過下面方法引入即可

import theme from '../theme.json' ECharts.registerTheme('ovilia-green', theme);

?

圖示:

總結

以上是生活随笔為你收集整理的前端学习(2471):vue-echarts和echarts的区别:的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。