1. el-dialog中的组件或内容想关闭后每次初始化
<el-dialog
:visible.sync="showCron"
v-if="showCron">
</el-dialog>
el-table中设置height后 合计行不显示
getSummaries(param) {
// 增加代码 start
this.$nextTick(() => {
this.$refs.table.doLayout();
});
// 增加代码 end
const { columns, data } = param;
let total = 0;
data.forEach(item => {
total += item.value;
});
return ['总计', total];
},
2. echarts 自适应
methods: {
resize() {
if (this.resizeTimer) clearTimeout(this.resizeTimer);
this.resizeTimer = setTimeout(() => {
this.$refs.numberAnalyseRef.$refs.BaseAnalyseChartRef.resize();
}, 200);
}
}
activated() {
...
this.resize();
window.addEventListener('resize', this.resize);
}
deactived() {
window.removeEventListener('resize', this.resize);
}
3. echarts tooltip内容在父容器中显示不全
tooltip: {
...,
confine: true // 将 tooltip 框限制在图表的区域内
}
4. 文字不可选中
.no-selected {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
5. css技巧
三角(向下)
.triangle {
width: 0px;
height: 0px;
border: 10px solid transparent;
border-top-color: red;
}