File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -253,5 +253,6 @@ OngletsAvecAccordeon.args = {
253253 initialSelectedIndex : 0 ,
254254 title1 : 'Un titre d’accordéon 1' ,
255255 title2 : 'Un titre d’accordéon 2' ,
256+ title3 : 'Un titre d’accordéon 3' ,
256257 expandedId : '' ,
257258}
Original file line number Diff line number Diff line change @@ -44,11 +44,34 @@ export default defineComponent({
4444 selectedIndex: this .initialSelectedIndex || 0 ,
4545 generatedIds: {},
4646 asc: true ,
47+ resizeObserver: null ,
4748 }
4849 },
4950
5051 mounted () {
51- this .renderTabs ()
52+ /*
53+ * Need to use a resize-observer as tab-content height can
54+ * change according to its inner components.
55+ */
56+ if (window .ResizeObserver ) {
57+ this .resizeObserver = new window.ResizeObserver (() => {
58+ this .renderTabs ()
59+ })
60+ }
61+
62+ this .$el .querySelectorAll (' .fr-tabs__panel' ).forEach ((element ) => {
63+ if (element) {
64+ this .resizeObserver ? .observe (element)
65+ }
66+ })
67+ },
68+
69+ unmounted () {
70+ this .$el .querySelectorAll (' .fr-tabs__panel' ).forEach ((element ) => {
71+ if (element) {
72+ this .resizeObserver ? .unobserve (element)
73+ }
74+ })
5275 },
5376
5477 methods: {
@@ -67,8 +90,6 @@ export default defineComponent({
6790 this .asc = idx > this .selectedIndex
6891 this .selectedIndex = idx
6992 this .$emit (' select-tab' , idx)
70- await this .$nextTick ()
71- this .renderTabs ()
7293 },
7394 async selectPrevious () {
7495 const newIndex = this .selectedIndex === 0 ? this .tabTitles .length - 1 : this .selectedIndex - 1
You can’t perform that action at this time.
0 commit comments