
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
echarts-package
Advanced tools
最新详细文档,请移步文档中阅读
因为该库是基于 echarts 来封装的,所以必须要依赖 echarts
echarts
步骤一: 下载 npm 包
npm install echarts
npm install echarts-package
步骤二: 引入安装插件
import * as echarts from "echarts"
Vue.prototype.$echarts = echarts
import echartsView from "echarts-package"
Vue.use(echartsView)
步骤三:
在页面上使用组件,在 echarts-package 中默认接收以 name 和 value 命名的属性,以此来渲染页面,后端返回的数据源以参数的形式传入 this.$eChartFn.handleData 方法中处理,将并选择对应的 template 作为渲染模板,最后将方法返回的配置传入 echartsView 组件中,即可渲染数据。
<template>
<div>
<!-- 为 ECharts 传入数据源和定义 -->
<echartsView :chart-option="chartOpt"></echartsView>
</div>
</template>
<script>
export default {
name: "App",
data() {
return {
chartOpt: {},
}
},
mounted() {
// 准备好模拟后端返回的数据列表
let data = [
{
name: "小兰",
value: 76,
},
{
name: "小绿",
value: 43,
},
{
name: "小红",
value: 27,
},
]
// 使用内置的 handleData 方法处理数据
this.chartOpt = this.$eChartFn.handleData({ template: "baseBar", data })
},
}
</script>
是的就是这么简单,只需要传入数据源和配置模板即可,效果如下所示

FAQs
基于 echarts 的封装的通用型组件,内置多种模板,坚持以简单的配置实现项目中的各种图表
The npm package echarts-package receives a total of 2 weekly downloads. As such, echarts-package popularity was classified as not popular.
We found that echarts-package demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.