Skip to content

Commit d06ad02

Browse files
committed
screen adaptation
1 parent 83d43e4 commit d06ad02

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

web/src/js/module/header/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export default {
209209
this.isNavMenuShow = false;
210210
},
211211
mouseover() {
212-
this.isNavMenuShow = this.$route.path != '/project'
212+
this.isNavMenuShow = (this.$route.path != '/project' && this.$route.path != '/newhome')
213213
},
214214
mouseleave() {
215215
this.isNavMenuShow = false

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545
<h3 class="item-header">
4646
<span>{{ $t('message.workspace.workspaceList') }}</span>
4747
</h3>
48-
<Row class="content-item" v-show="visual === 'card'">
48+
<Row ref="row" class="content-item" v-show="visual === 'card'">
4949
<i-col
50+
ref="col"
5051
class="workspace-item"
5152
:xs="12" :sm="8" :md="4" :lg="4"
5253
v-for="item in originWorkspaceData"
@@ -147,13 +148,30 @@ export default {
147148
pageSize: 4,
148149
pageNum: 1,
149150
videosClick: 1,
150-
videosMaxClick: null
151+
videosMaxClick: null,
152+
listWrap: 0,//屏幕宽度
151153
}
152154
},
153155
created() {
154156
this.getWorkspaces();
155157
this.getVideos();
156158
},
159+
mounted(){
160+
this.listWrap = this.$refs.row.$el.offsetWidth;
161+
this.initWorkspace();
162+
window.onresize = () => {
163+
const that = this
164+
return (() => {
165+
that.listWrap = this.$refs.row.$el.offsetWidth;
166+
})()
167+
}
168+
},
169+
watch: {
170+
'listWrap': function(val){ //监听容器宽度变化
171+
this.pageSize = Math.floor(val / 252)
172+
this.initWorkspace();
173+
},
174+
},
157175
methods: {
158176
getWorkspaces() {
159177
// 获取工作空间数据

0 commit comments

Comments
 (0)