File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
web/src/js/view/newhome/module/workspace Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,8 @@ export default {
162
162
videosClick: 1 ,
163
163
videosMaxClick: null ,
164
164
listWrap: 0 ,// 屏幕宽度
165
+ workspaceItemWidth: 0 , // workspaceItem 宽度
166
+ workspaceItemMargin: 30
165
167
}
166
168
},
167
169
created () {
@@ -170,7 +172,6 @@ export default {
170
172
},
171
173
mounted (){
172
174
this .listWrap = this .$refs .row .$el && this .$refs .row .$el .offsetWidth ;
173
- this .initWorkspace ();
174
175
window .onresize = () => {
175
176
const that = this
176
177
return (() => {
@@ -183,7 +184,8 @@ export default {
183
184
},
184
185
watch: {
185
186
' listWrap ' : function (val ){ // 监听容器宽度变化
186
- this .pageSize = Math .floor (val / 252 )
187
+ this .listWrap = val;
188
+ this .pageSize = Math .floor (this .listWrap / this .workspaceItemWidth )
187
189
this .initWorkspace ();
188
190
},
189
191
},
@@ -192,9 +194,13 @@ export default {
192
194
// 获取工作空间数据
193
195
this .loading = true ;
194
196
api .fetch (' dss/workspaces' , {}, ' get' ).then ((res ) => {
195
- this .filteredData = this .cacheData = res .workspaces ;
196
- this .initWorkspace ();
197
- this .loading = false ;
197
+ this .originWorkspaceData = this .filteredData = this .cacheData = res .workspaces ;
198
+ this .$nextTick (() => {
199
+ this .workspaceItemWidth = this .$refs .col [0 ] && this .$refs .col [0 ].$el .offsetWidth ;
200
+ this .pageSize = Math .floor (this .listWrap / (this .workspaceItemWidth + this .workspaceItemMargin ))
201
+ this .initWorkspace ();
202
+ this .loading = false ;
203
+ })
198
204
}).catch (() => {
199
205
this .loading = false ;
200
206
});
You can’t perform that action at this time.
0 commit comments