File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
packages/components/upload Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -132,9 +132,26 @@ export default class Upload extends SuperComponent {
132132 } ) ;
133133 }
134134
135+ /**
136+ * 重置拖拽布局状态
137+ */
138+ resetDragLayout ( ) {
139+ this . setData ( {
140+ dragBaseData : { } ,
141+ dragWrapStyle : '' ,
142+ dragLayout : false ,
143+ } ) ;
144+ }
145+
135146 initDragLayout ( ) {
136147 const { draggable, disabled } = this . properties ;
137- if ( ! draggable || disabled ) return ;
148+ const { customFiles } = this . data ;
149+
150+ if ( ! draggable || disabled || customFiles . length === 0 ) {
151+ this . resetDragLayout ( ) ;
152+ return ;
153+ }
154+
138155 this . initDragList ( ) ;
139156 this . initDragBaseData ( ) ;
140157 }
@@ -170,15 +187,7 @@ export default class Upload extends SuperComponent {
170187 }
171188
172189 initDragBaseData ( ) {
173- const { classPrefix, rows, column, customFiles } = this . data ;
174- if ( customFiles . length === 0 ) {
175- this . setData ( {
176- dragBaseData : { } ,
177- dragWrapStyle : '' ,
178- dragLayout : false ,
179- } ) ;
180- return ;
181- }
190+ const { classPrefix, rows, column } = this . data ;
182191 const query = this . createSelectorQuery ( ) ;
183192 const selectorGridItem = `.${ classPrefix } >>> .t-grid-item` ;
184193 const selectorGrid = `.${ classPrefix } >>> .t-grid` ;
You can’t perform that action at this time.
0 commit comments