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 {
162162 videosClick: 1 ,
163163 videosMaxClick: null ,
164164 listWrap: 0 ,// 屏幕宽度
165+ workspaceItemWidth: 0 , // workspaceItem 宽度
166+ workspaceItemMargin: 30
165167 }
166168 },
167169 created () {
@@ -170,7 +172,6 @@ export default {
170172 },
171173 mounted (){
172174 this .listWrap = this .$refs .row .$el && this .$refs .row .$el .offsetWidth ;
173- this .initWorkspace ();
174175 window .onresize = () => {
175176 const that = this
176177 return (() => {
@@ -183,7 +184,8 @@ export default {
183184 },
184185 watch: {
185186 ' listWrap ' : function (val ){ // 监听容器宽度变化
186- this .pageSize = Math .floor (val / 252 )
187+ this .listWrap = val;
188+ this .pageSize = Math .floor (this .listWrap / this .workspaceItemWidth )
187189 this .initWorkspace ();
188190 },
189191 },
@@ -192,9 +194,13 @@ export default {
192194 // 获取工作空间数据
193195 this .loading = true ;
194196 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+ })
198204 }).catch (() => {
199205 this .loading = false ;
200206 });
You can’t perform that action at this time.
0 commit comments