@@ -74,6 +74,12 @@ defineSlots<{
7474 isCollapsed: typeof isCollapsed .value
7575 /** Is the panel expanded */
7676 isExpanded: typeof isExpanded .value
77+ /** If panel is `collapsible`, collapse it fully. */
78+ collapse: typeof collapse
79+ /** If panel is currently collapsed, expand it to its most recent size. */
80+ expand: typeof expand
81+ /** Resize panel to the specified percentage (1 - 100). */
82+ resize: typeof resize
7783 }) => any
7884}>()
7985
@@ -134,23 +140,29 @@ const style = computed(() => getPanelStyle(panelDataRef.value, props.defaultSize
134140const isCollapsed = computed (() => isPanelCollapsed (panelDataRef .value ))
135141const isExpanded = computed (() => ! isCollapsed .value )
136142
143+ function collapse() {
144+ collapsePanel (panelDataRef .value )
145+ }
146+
147+ function expand() {
148+ expandPanel (panelDataRef .value )
149+ }
150+
151+ function resize(size : number ) {
152+ resizePanel (panelDataRef .value , size )
153+ }
154+
137155defineExpose ({
138156 /** If panel is `collapsible`, collapse it fully. */
139- collapse : () => {
140- collapsePanel (panelDataRef .value )
141- },
157+ collapse ,
142158 /** If panel is currently collapsed, expand it to its most recent size. */
143- expand : () => {
144- expandPanel (panelDataRef .value )
145- },
159+ expand ,
146160 /** Gets the current size of the panel as a percentage (1 - 100). */
147161 getSize() {
148162 return getPanelSize (panelDataRef .value )
149163 },
150164 /** Resize panel to the specified percentage (1 - 100). */
151- resize : (size : number ) => {
152- resizePanel (panelDataRef .value , size )
153- },
165+ resize ,
154166 /** Returns `true` if the panel is currently collapsed */
155167 isCollapsed ,
156168 /** Returns `true` if the panel is currently not collapsed */
@@ -174,6 +186,9 @@ defineExpose({
174186 <slot
175187 :is-collapsed =" isCollapsed"
176188 :is-expanded =" isExpanded"
189+ :expand =" expand"
190+ :collapse =" collapse"
191+ :resize =" resize"
177192 />
178193 </Primitive >
179194</template >
0 commit comments