@@ -99,7 +99,7 @@ const Overflow = defineComponent({
99
99
const mergedRestWidth = computed ( ( ) => Math . max ( prevRestWidth . value , restWidth . value ) ) ;
100
100
101
101
// ================================= Data =================================
102
- const isResponsive = computed ( ( ) => props . data . length && props . maxCount === RESPONSIVE ) ;
102
+ const isResponsive = computed ( ( ) => ! ! ( props . data . length && props . maxCount === RESPONSIVE ) ) ;
103
103
const invalidate = computed ( ( ) => props . maxCount === INVALIDATE ) ;
104
104
105
105
/**
@@ -183,7 +183,7 @@ const Overflow = defineComponent({
183
183
184
184
// ================================ Effect ================================
185
185
const getItemWidth = ( index : number ) => {
186
- return itemWidths . value . get ( getKey ( mergedData [ index ] , index ) ) ;
186
+ return itemWidths . value . get ( getKey ( mergedData . value [ index ] , index ) ) ;
187
187
} ;
188
188
189
189
watch (
@@ -215,8 +215,11 @@ const Overflow = defineComponent({
215
215
totalWidth += currentItemWidth ;
216
216
217
217
if (
218
- i === lastIndex - 1 &&
219
- totalWidth + getItemWidth ( lastIndex ) ! <= mergedContainerWidth . value
218
+ // Only one means `totalWidth` is the final width
219
+ ( lastIndex === 0 && totalWidth <= mergedContainerWidth . value ) ||
220
+ // Last two width will be the final width
221
+ ( i === lastIndex - 1 &&
222
+ totalWidth + getItemWidth ( lastIndex ) ! <= mergedContainerWidth . value )
220
223
) {
221
224
// Additional check if match the end
222
225
updateDisplayCount ( lastIndex ) ;
@@ -228,11 +231,6 @@ const Overflow = defineComponent({
228
231
suffixFixedStart . value =
229
232
totalWidth - currentItemWidth - suffixWidth . value + restWidth . value ;
230
233
break ;
231
- } else if ( i === lastIndex ) {
232
- // Reach the end
233
- updateDisplayCount ( lastIndex ) ;
234
- suffixFixedStart . value = totalWidth - suffixWidth . value ;
235
- break ;
236
234
}
237
235
}
238
236
0 commit comments