Skip to content

Commit 9b4a273

Browse files
committed
优化新增文章页面样式,根据浏览器分辨率设置编辑器高度
1 parent cf50b92 commit 9b4a273

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/components/WriteArticle.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
<div class="ArticleTitle">
3434
<input placeholder="文章缩略图" @change="SetArticleCover" type="file" multiple="multiple" ref='selectfile'>
3535
</div>
36-
<img :src="ArticleCover" v-show="ArticleCover" style="width: 150px;height: 100px">
36+
<img :src="ArticleCover" v-show="ArticleCover" style="width: 70px;height: 40px">
3737
<div class="WriteSubmit">
3838
<el-button type="primary" @click="SubmitArticle()">确认</el-button>
3939
</div>
4040
</div>
4141

4242
<div class="ArticleDetail" id="ArticleDetail">
43-
<mavon-editor v-model="Content" :isHljs = "true" @imgAdd="$imgAdd" ref=md></mavon-editor>
43+
<mavon-editor v-model="Content" :isHljs = "true" @imgAdd="$imgAdd" ref=md :style="{height: editorHeight}"></mavon-editor>
4444
</div>
4545
</div>
4646
</div>
@@ -71,7 +71,8 @@
7171
ArticleTagOptions: [],
7272
ArticleTag: '',
7373
ArticleCover:'',
74-
CommentNum:0
74+
CommentNum:0,
75+
editorHeight: 0
7576
}
7677
},
7778
methods:{
@@ -183,6 +184,9 @@
183184
}else{
184185
185186
}
187+
188+
// 根据分辨率,动态设置编辑器高度
189+
That.editorHeight = window.screen.height - 375 + 'px';
186190
},
187191
components:{
188192
TopBar:TopBar
@@ -221,7 +225,6 @@
221225
.ArticleDetail {
222226
margin-top: 1rem;
223227
width: 100%;
224-
height: 800px;
225228
}
226229
227230
.ArticleDetail textarea {
@@ -230,7 +233,7 @@
230233
}
231234
.WriteSubmit{
232235
text-align: right;
233-
margin-top: 1rem;
236+
margin-left: 10px;
234237
}
235238
.editortoolbar{
236239
border: 1px solid #ccc;

0 commit comments

Comments
 (0)