fix(#518): make sure charts fit the container after next browser UI render

This commit is contained in:
Justineo
2021-03-05 01:06:45 +08:00
parent 37cf20df05
commit 6526e2e43c
5 changed files with 18 additions and 8 deletions

View File

@ -13,6 +13,7 @@ import {
onMounted,
onUnmounted,
h,
nextTick,
PropType,
watchEffect,
Vue2
@ -143,6 +144,11 @@ export default defineComponent({
});
instance.setOption(option || realOption.value, realUpdateOptions.value);
// Make sure the chart fits the container in next UI render (after current task)
setTimeout(() => {
instance.resize();
});
}
function setOption(option: Option, updateOptions?: UpdateOptions) {