@@ -20,12 +20,12 @@ const resize = tab => {
2020 }
2121
2222 const scroll = tab . scroll
23- const lastItem = [ ...tabNav . querySelectorAll ( '.tabs-item' ) ] . pop ( )
23+ const lastItem = [ ...tabNav . querySelectorAll ( '.tabs-item-wrap ' ) ] . pop ( )
2424 if ( lastItem ) {
2525 if ( tab . vertical ) {
2626 const tabHeight = scroll . offsetHeight
2727 let itemHeight = 0
28- tabNav . querySelectorAll ( '.tabs-item' ) . forEach ( v => {
28+ tabNav . querySelectorAll ( '.tabs-item-wrap ' ) . forEach ( v => {
2929 itemHeight += v . offsetHeight
3030 } )
3131 if ( itemHeight > tabHeight ) {
@@ -39,7 +39,7 @@ const resize = tab => {
3939 // Item 总宽度大于 Nav 宽度
4040 const tabWidth = scroll . offsetWidth
4141 let itemWidth = 0
42- tabNav . querySelectorAll ( '.tabs-item' ) . forEach ( v => {
42+ tabNav . querySelectorAll ( '.tabs-item-wrap ' ) . forEach ( v => {
4343 itemWidth += v . offsetWidth
4444 } )
4545 if ( itemWidth > tabWidth ) {
@@ -55,7 +55,7 @@ const resize = tab => {
5555const active = tab => {
5656 resize ( tab )
5757
58- const activeTab = tab . tabNav . querySelector ( '.tabs-item.active' )
58+ const activeTab = tab . tabNav . querySelector ( '.tabs-item-wrap .active' )
5959 if ( activeTab ) {
6060 if ( tab . vertical ) {
6161 const top = getPosition ( activeTab ) . top - getPosition ( activeTab . parentNode ) . top + activeTab . offsetHeight
@@ -103,17 +103,21 @@ const active = tab => {
103103}
104104
105105const setDraggable = tab => {
106- disposeDragItems ( tab . dragItems )
106+ disposeDragItems ( tab . dragItems ) ;
107+
108+ if ( tab . el . querySelector ( '.tabs-item-wrap[draggable="true"]' ) === null ) {
109+ return ;
110+ }
107111
108112 let dragItem = null ;
109113 let index = 0
110114
111- tab . dragItems = [ ...tab . el . firstChild . querySelectorAll ( '.tabs-item' ) ]
115+ tab . dragItems = [ ...tab . el . firstChild . querySelectorAll ( '.tabs-item-wrap ' ) ]
112116 tab . dragItems . forEach ( item => {
113117 EventHandler . on ( item , 'dragstart' , e => {
114118 item . parentNode . classList . add ( 'tab-dragging' )
115119 item . classList . add ( 'tab-drag' )
116- tab . dragItems = [ ...tab . el . firstChild . querySelectorAll ( '.tabs-item' ) ]
120+ tab . dragItems = [ ...tab . el . firstChild . querySelectorAll ( '.tabs-item-wrap ' ) ]
117121 index = tab . dragItems . indexOf ( item )
118122 dragItem = item
119123 e . dataTransfer . effectAllowed = 'move'
0 commit comments