diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 00f22234..0b689451 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -14,6 +14,7 @@ "sdras.vue-vscode-snippets", "vue.volar", "whtouche.vscode-js-console-utils", - "zhuangtongfa.material-theme" + "zhuangtongfa.material-theme", + "tu6ge.naive-ui-intelligence" ] } diff --git a/src/hooks/common/echarts.ts b/src/hooks/common/echarts.ts index 45c33e12..73306834 100644 --- a/src/hooks/common/echarts.ts +++ b/src/hooks/common/echarts.ts @@ -210,6 +210,10 @@ export function useEcharts(optionsFactory: () => T, hooks: C // render chart await render(); + + if (chart) { + await onUpdated?.(chart); + } } scope.run(() => { diff --git a/src/typings/common.d.ts b/src/typings/common.d.ts index 31829ab4..699d3b37 100644 --- a/src/typings/common.d.ts +++ b/src/typings/common.d.ts @@ -14,7 +14,7 @@ declare namespace CommonType { * @property value: The option value * @property label: The option label */ - type Option = { value: K; label: string }; + type Option = { value: K; label: M }; /** The record type */ type Record = { [key in K]: string }; diff --git a/src/utils/common.ts b/src/utils/common.ts index 231eb366..22ac43e7 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -21,7 +21,7 @@ export function transformRecordToOption>(record return Object.entries(record).map(([value, label]) => ({ value, label - })) as CommonType.Option[]; + })) as CommonType.Option[]; } export function transformRecordToNumberOption>(record: T) { @@ -36,10 +36,10 @@ export function transformRecordToNumberOption>( * * @param options */ -export function translateOptions(options: CommonType.Option[]) { +export function translateOptions(options: CommonType.Option[]) { return options.map(option => ({ ...option, - label: $t(option.label as App.I18n.I18nKey) + label: $t(option.label) })); }