File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 45
45
data : () => ({
46
46
tabs: [],
47
47
activeTabHash: ' ' ,
48
+ activeTabIndex: 0 ,
48
49
lastActiveTabHash: ' ' ,
49
50
}),
50
51
110
111
111
112
this .$emit (' changed' , { tab: selectedTab });
112
113
114
+ this .activeTabHash = selectedTab .hash ;
115
+ this .activeTabIndex = this .getTabIndex (selectedTabHash);
116
+
113
117
this .lastActiveTabHash = this .activeTabHash = selectedTab .hash ;
114
118
115
119
expiringStorage .set (this .storageKey , selectedTab .hash , this .cacheLifetime );
139
143
});
140
144
}
141
145
},
146
+
147
+ getTabIndex (hash ){
148
+ const tab = this .findTab (hash);
149
+
150
+ return this .tabs .indexOf (tab);
151
+ },
152
+
153
+ getTabHash (index ){
154
+ const tab = this .tabs .find (tab => this .tabs .indexOf (tab) === index);
155
+
156
+ if (! tab) {
157
+ return ;
158
+ }
159
+
160
+ return tab .hash ;
161
+ },
162
+
163
+ getActiveTab (){
164
+ return this .findTab (this .activeTabHash );
165
+ },
166
+
167
+ getActiveTabIndex () {
168
+ return this .getTabIndex (this .activeTabHash );
169
+ },
142
170
},
143
171
};
144
172
</script >
You can’t perform that action at this time.
0 commit comments