javascript - 任何人都可以解释语法
问题描述
const lastTick = this.xAxis[0].ticks[this.xAxis[0].tickPositions.length - 1];
const { width } = lastTick.label.getBBox();
const { chartWidth } = this;
lastTick.label.attr({ x: chartWidth - (0.7) * width });
这是highcharts代码。我想要{ width }
,的意思{ chartWidth }
。
解决方案
这称为解构赋值。它类似于写作
const chartWidth = this.chartWidth;
const width = lastTick.label.getBBox().width;
推荐阅读
- list - 在给定所有可能组合的列表的情况下实现排列
- linux - 如何强制 g++ 尊重#define _POSIX_C_SOURCE 200809L
- delphi - 使用 StringList 解析文本:\n vs #13#10 vs sLineBreak
- html - 更新方法传递旧值而不是 Angular 中的新值
- c - 如何在需要用户输入的程序中使用 c 中的 gnu 调试器
- php - 使用 laravel 服务并将代码注入控制器
- android - 如何使用 ARCORE 从 ARScene 相机扫描二维码
- java - OKHttp的BufferedSink(或BufferedSource)中如何实现seek()函数?
- python - Tkinter 通过命令 lambda 传递 StringVar.get 给出初始值
- c++ - 为什么我的多线程代码比串行版本慢,我该怎么做才能加快速度?