From 12612e9f8b251bee75d5c2afff3fa46f713cba4a Mon Sep 17 00:00:00 2001 From: redhoodsu Date: Tue, 29 Aug 2023 17:31:11 +0800 Subject: [PATCH] release(toolbar): v0.4.3 --- index.json | 2 +- src/toolbar/index.ts | 4 ++++ src/toolbar/package.json | 2 +- src/toolbar/react.tsx | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.json b/index.json index 7828d91..9646702 100644 --- a/index.json +++ b/index.json @@ -334,7 +334,7 @@ }, "toolbar": { "react": true, - "version": "0.4.2", + "version": "0.4.3", "style": true, "icon": false, "test": true, diff --git a/src/toolbar/index.ts b/src/toolbar/index.ts index 3e60b6c..36c4ad9 100644 --- a/src/toolbar/index.ts +++ b/src/toolbar/index.ts @@ -142,6 +142,10 @@ export class LunaToolbarSelect extends LunaToolbarItem { this.setOptions(options) $select.on('change', () => this.onChange($select.val())) } + setValue(value: string) { + this.$select.val(value) + this.value = value + } setOptions(options: types.PlainObj) { this.$select.html( map( diff --git a/src/toolbar/package.json b/src/toolbar/package.json index a63f944..f4db0af 100644 --- a/src/toolbar/package.json +++ b/src/toolbar/package.json @@ -1,6 +1,6 @@ { "name": "toolbar", - "version": "0.4.2", + "version": "0.4.3", "description": "Application toolbar", "luna": { "react": true diff --git a/src/toolbar/react.tsx b/src/toolbar/react.tsx index 51ab8b8..2c27a97 100644 --- a/src/toolbar/react.tsx +++ b/src/toolbar/react.tsx @@ -108,6 +108,12 @@ export const LunaToolbarSelect: FC = (props) => { [props.disabled] ) + useEffect(() => { + if (toolbarSelect.current) { + toolbarSelect.current.setValue(props.value) + } + }, [props.value]) + useEffect(() => { if (toolbarSelect.current) { toolbarSelect.current.setOptions(props.options)