Skip to content

Commit 1c12d3c

Browse files
committed
set fixed width to workspaceItem to fit the screen
1 parent 76601aa commit 1c12d3c

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

web/src/js/view/newhome/module/workspace/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
position: relative;
7979
background: url("../../images/workspace.png") center center no-repeat;
8080
background-size: cover;
81-
min-width: 222px;
81+
width: 222px;
8282
.name {
8383
display: block;
8484
font-size: 16px;

web/src/js/view/newhome/module/workspace/index.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ export default {
162162
videosClick: 1,
163163
videosMaxClick: null,
164164
listWrap: 0,//屏幕宽度
165-
workspaceItemWidth: 0, // workspaceItem 宽度
166-
workspaceItemMargin: 30
165+
workspaceItemWidth: 252, // workspaceItem 宽度
167166
}
168167
},
169168
created() {
@@ -184,8 +183,7 @@ export default {
184183
},
185184
watch: {
186185
'listWrap': function(val){ //监听容器宽度变化
187-
this.listWrap = val;
188-
this.pageSize = Math.floor(this.listWrap / this.workspaceItemWidth)
186+
this.pageSize = Math.floor(val / this.workspaceItemWidth)
189187
this.initWorkspace();
190188
},
191189
},
@@ -195,12 +193,8 @@ export default {
195193
this.loading = true;
196194
api.fetch('dss/workspaces', {}, 'get').then((res) => {
197195
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-
})
196+
this.initWorkspace();
197+
this.loading = false;
204198
}).catch(() => {
205199
this.loading = false;
206200
});

0 commit comments

Comments
 (0)