From beec26367fd56c89c7d08db23563e776f28945a5 Mon Sep 17 00:00:00 2001 From: Justineo Date: Sun, 4 Aug 2024 07:38:57 +0800 Subject: [PATCH] fix: fix type for `autoresize`, closes #800 --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/composables/autoresize.ts | 13 +++---------- src/types.ts | 7 +++++++ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5850ec5..b2a4721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 7.0.1 + +* Fixed type for `autoresize`. + ## 7.0.0 > Other prerelease changes: diff --git a/package.json b/package.json index cdcfbe2..dc6503b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-echarts", - "version": "7.0.0", + "version": "7.0.1", "description": "Vue.js component for Apache ECharts™.", "license": "MIT", "repository": "https://github.com/ecomfe/vue-echarts.git", diff --git a/src/composables/autoresize.ts b/src/composables/autoresize.ts index 414c5af..7658346 100644 --- a/src/composables/autoresize.ts +++ b/src/composables/autoresize.ts @@ -2,18 +2,11 @@ import { watch } from "vue-demi"; import { throttle } from "echarts/core"; import type { Ref, PropType } from "vue-demi"; -import type { EChartsType } from "../types"; - -type AutoresizeProp = - | boolean - | { - throttle?: number; - onResize?: () => void; - }; +import type { EChartsType, AutoResize } from "../types"; export function useAutoresize( chart: Ref, - autoresize: Ref, + autoresize: Ref, root: Ref ): void { watch( @@ -63,5 +56,5 @@ export function useAutoresize( } export const autoresizeProps = { - autoresize: [Boolean, Object] as PropType + autoresize: [Boolean, Object] as PropType }; diff --git a/src/types.ts b/src/types.ts index 4d61876..9a21aa9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -23,6 +23,13 @@ export type EventTarget = EChartsType | ZRenderType; type SetOptionType = EChartsType["setOption"]; export type Option = Parameters[0]; +export type AutoResize = + | boolean + | { + throttle?: number; + onResize?: () => void; + }; + export type LoadingOptions = { text?: string; textColor?: string;