遇到的难题汇总
2023-02-18 16:31:03 时间
一、在布局中动态设置左侧导航的高度
布局里可能有很多层级的子组件,在子组件没有完全加载之前,没法知道容器的高度,因此很难正确设置左侧导航的高度。
另外,在交互过程中,容器的高度也会改变,还有当浏览器宽高改变或者屏幕分辨率改变时,这些情况下也需要动态设置左侧导航的高度。
有没有办法在布局里知道是否所有的子组件均已加载完毕?或者有没有办法知道容器的高度是否改变?
一种思路是:不在布局里设置左侧导航高度,在最后一个子组件的componentDidUpdate
事件中设置,这样的问题是每个页面都需要找到最后一个子组件并且设置高度。
解决方法:在window的resize事件里监控innerHeight(document.documentElement.clientHeight),并根据innerHeight来动态设置左侧导航的高度。
二、ECharts中横坐标出现重影现象(文本加粗)
正常的文本:
重影的文本:
很奇怪的是:这个问题在有些电脑会出现,有些电脑不会。
------------------------------------ 2019.1.16 Update ------------------------------------
解决方法:
初始化ECharts时将像素比的参数 devicePixelRatio 设置成2倍(默认是 1),注意要在 init 方法的第三个参数中设置,第二个参数是设置主题的,置为 null 即可。
ECharts.init(el); -> ECharts.init(el, null, {devicePixelRatio: 2});
顺便贴下 init 方法的源码:
/**
* @param {HTMLElement} dom
* @param {Object} [theme]
* @param {Object} opts
* @param {number} [opts.devicePixelRatio] Use window.devicePixelRatio by default
* @param {string} [opts.renderer] Currently only 'canvas' is supported.
* @param {number} [opts.width] Use clientWidth of the input `dom` by default.
* Can be 'auto' (the same as null/undefined)
* @param {number} [opts.height] Use clientHeight of the input `dom` by default.
* Can be 'auto' (the same as null/undefined)
*/
export function init(dom, theme, opts) {
var existInstance = getInstanceByDom(dom);
if (existInstance) {
return existInstance;
}
var chart = new ECharts(dom, theme, opts);
chart.id = 'ec_' + idBase++;
instances[chart.id] = chart;
if (dom.setAttribute) {
dom.setAttribute(DOM_ATTRIBUTE_KEY, chart.id);
}
else {
dom[DOM_ATTRIBUTE_KEY] = chart.id;
}
enableConnect(chart);
return chart;
}
相关文章
- 论文解读(GraphMAE)《GraphMAE: Self-Supervised Masked Graph Autoencoders》
- 论文解读(GMAE)《Graph Masked Autoencoders with Transformers》
- 论文解读(DMVCJ)《Deep Embedded Multi-View Clustering via Jointly Learning Latent Representations and Graphs》
- pytorch 中layernorm 的使用
- 论文解读目录
- 论文解读(ARVGA)《Learning Graph Embedding with Adversarial Training Methods》
- 论文解读(gCooL)《Graph Communal Contrastive Learning》
- pytorch矩阵乘法总结
- 论文解读(SUBLIME)《Towards Unsupervised Deep Graph Structure Learning》
- 变分自编码器理解
- 论文解读(LA-GNN)《Local Augmentation for Graph Neural Networks》
- 论文解读(GraphDA)《Data Augmentation for Deep Graph Learning: A Survey》
- 论文解读(GCC)《GCC: Graph Contrastive Coding for Graph Neural Network Pre-Training》
- 论文解读《Strategies for Pre-training Graph Neural Networks》
- 论文解读(AGE)《Adaptive Graph Encoder for Attributed Graph Embedding》
- 论文解读(Graph-Bert)《Graph-Bert: Only Attention is Needed for Learning Graph Representations》
- 论文解读(FDGATII)《FDGATII : Fast Dynamic Graph Attention with Initial Residual and Identity Mapping》
- 论文解读(SCGC)《Simple Contrastive Graph Clustering》
- 论文解读(SCAGC)《Self-supervised Contrastive Attributed Graph Clustering》
- tqdm介绍及常用方法