当前位置: 首页 > news >正文

义乌便宜自适应网站建设厂家大兴模版网站建设哪家好

义乌便宜自适应网站建设厂家,大兴模版网站建设哪家好,西安网页设计培训学校,西安网站建设第一品牌记录 vue3Ts 项目中#xff0c;按需引入echarts并进行二次封装使用。 1、安装#xff1a;npm i echarts 2、新增按需引入配置文件#xff1a;echartsConfig.ts // 引入 echarts 核心模块#xff0c;核心模块提供了 echarts 使用必须要的接口。 import * as echarts from …记录 vue3Ts 项目中按需引入echarts并进行二次封装使用。 1、安装npm i echarts 2、新增按需引入配置文件echartsConfig.ts // 引入 echarts 核心模块核心模块提供了 echarts 使用必须要的接口。 import * as echarts from echarts/core;// 引入内置组件组件后缀都为Component import {TitleComponent,TooltipComponent,GridComponent,PolarComponent,AriaComponent,ParallelComponent,LegendComponent,RadarComponent,ToolboxComponent,DatasetComponent, // 数据集组件DataZoomComponent,VisualMapComponent,TimelineComponent,CalendarComponent,GraphicComponent,TransformComponent, // 数据转换器组件(filter, sort) } from echarts/components;// 引入渲染器echarst默认使用canvas渲染引入 CanvasRenderer 或者 SVGRenderer 是必须的一步 import { CanvasRenderer, SVGRenderer } from echarts/renderers;// 标签自动布局、全局过渡动画等特性 import { LabelLayout, UniversalTransition } from echarts/features;// 引入图表类型后缀都为Chart import {BarChart,LineChart,PieChart,MapChart,RadarChart,PictorialBarChart, } from echarts/charts;// 注册必须的组件 echarts.use([// 内置组件TitleComponent,TooltipComponent,GridComponent,PolarComponent,AriaComponent,ParallelComponent,LegendComponent,RadarComponent,ToolboxComponent,DatasetComponent,DataZoomComponent,VisualMapComponent,TimelineComponent,CalendarComponent,GraphicComponent,TransformComponent,// 渲染器CanvasRenderer,SVGRenderer,// 特性LabelLayout,UniversalTransition,// 图表BarChart,LineChart,PieChart,MapChart,RadarChart,PictorialBarChart, ]);export default echarts;3、封装成hooksuseEcharts.ts import {Ref,shallowRef,unref,onMounted,onDeactivated,onBeforeUnmount, } from vue;import echarts from /components/baseEcharts/config;export type EChartsCoreOption echarts.EChartsCoreOption;const useEcharts (elRef: RefHTMLDivElement, options: EChartsCoreOption) {const charts shallowRefecharts.ECharts();const setOptions (options: EChartsCoreOption) {charts.value charts.value.setOption(options);};// 初始化const initCharts (themeColor?: Arraystring) {const el unref(elRef);if (!el || !unref(el)) {return;}charts.value echarts.init(el);if (themeColor) {options.color themeColor;}setOptions(options);};// 重新窗口变化时重新计算const resize () {charts.value charts.value.resize();};onMounted(() {window.addEventListener(resize, resize);});// 页面keepAlive时不监听页面onDeactivated(() {window.removeEventListener(resize, resize);});onBeforeUnmount(() {window.removeEventListener(resize, resize);});return {initCharts,setOptions,resize,}; };export { useEcharts };4、封装成基础组件baseEcharts.vue templatediv:style{width: width,height: height,}refechartsRef/ /templatescript setup langts import { ref, onMounted, watch, PropType } from vue; import { useEcharts, EChartsCoreOption } from ./useEchart.ts; // 引入hooksconst props defineProps({options: { type: Object as PropTypeEChartsCoreOption, required: true },height: { type: String, default: 100% },width: { type: String, default: 100% },themeColors: { type: Array as PropTypestring[], default: () [] }, });const echartsRef ref();const { setOptions, initCharts } useEcharts(echartsRef, props.options);watch(() props.options,(nVal) {let targetOptions: EChartsCoreOption {};if (props.themeColors props.themeColors.length 0) {targetOptions { ...nVal };targetOptions.color props.themeColors;} else {targetOptions { ...nVal };}setOptions(targetOptions);} );onMounted(() {initCharts(); }); /script5、使用示例useExample.vue templateBaseEcharts :optionsoptions height300px / /templatescript langts setup import BaseEcharts from /components/baseEcharts/index.vue;const options {title: {text: 使用示例,subtext: 二级标题,subTextStyle: {fontSize: 16,fontWeight: normal,left: center,y: center,},},tooltip: {trigger: axis,axisPointer: {lineStyle: {width: 1,color: #008000,},},},grid: {left: 1%,right: 1%,bottom: 1%,top: 60px,containLabel: true,},xAxis: {type: category,data: [1月, 2月, 3月, 4月, 5月, 6月, 7月],axisLabel: {interval: 0,rotate: 30,},},yAxis: {axisLabel: {formatter: (val: number) {return val;},},},series: [{name: 收入,type: bar,stack: Total,data: [200, 301, 402, 503, 604, 705, 806],},{name: 支出,type: line,stack: Total,data: [100, 210, 1020, 230, 20, 250, 60],},], }; /script
http://www.pierceye.com/news/722807/

相关文章:

  • 学校网站建设经验介绍西安建设网站公司
  • 江西营销网站建设公司的企业诚信建设分析
  • 生活家装饰官方网站动画设计考研
  • 网站内部的信息安全建设怎么才能在百度上做引流呢
  • 男男做的视频网站wordpress 系统
  • 网站建设合同 附件上海网站制作费用
  • 知名的环保行业网站开发开发一个app难吗
  • 律师网站建设方案网站企业制作
  • 基础建设期刊在哪个网站可以查做网站咨询
  • 万网个人网站备案查询甘肃建设银行网站
  • 网站建设有什么费用wordpress国外主题网站
  • 手机网站下拉菜单代码com域名代表什么
  • 网站右侧信息跟随左侧菜单栏变化好牛网站建设
  • 手机网站pc网站免费国外服务器租用
  • 商城网站建设服务wordpress手机导航三横拦
  • app设计欣赏网站长沙制作公园仿竹护栏
  • 景泰县做网站网站建设上市
  • 电子商务网站开发课题简介php mysql网站开发...
  • 如何提升网站alexa排名wordpress加联系方式
  • 餐厅网站模版wordpress linux
  • 网站seo优化怎么做mes系统
  • 江津网站建设公司做外贸去哪个网站找客户
  • 网站建设-部署与发布wordpress怎么代码高亮
  • 自己做的网站本地虚拟上传wordpress 不能评论
  • 百度贴吧网站开发需求分析怎么免费自己做推广
  • 网站怎么访问自己做的网页中国园林网
  • 郑州服装网站建设做营销型网站用那个cms好
  • 网站登录页面模板下载wordpress添加随机图片
  • 贵阳网站建设哪家便宜关键词林俊杰mp3在线听
  • 怎么看网站是哪个系统做的怎么自己建网站赚钱