Skip to content

Commit 1e00d9a

Browse files
author
shimh-develop
committed
写文章工具栏置顶优化
1 parent 387ade5 commit 1e00d9a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

blog-app/src/views/blog/BlogWrite.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
</el-input>
2626

2727
</div>
28+
<div id="placeholder" style="visibility: hidden;height: 89px;display: none;"></div>
2829
<markdown-editor :editor="articleForm.editor" class="me-write-editor"></markdown-editor>
2930
</el-main>
3031
</el-container>
@@ -74,7 +75,7 @@ export default {
7475
name: 'BlogWrite',
7576
mounted() {
7677
this.getCategorysAndTags()
77-
this.editorToolBarToFixedWrapper = this.$_.throttle(this.editorToolBarToFixed, 1000)
78+
this.editorToolBarToFixedWrapper = this.$_.throttle(this.editorToolBarToFixed, 200)
7879
7980
window.addEventListener('scroll', this.editorToolBarToFixedWrapper, false);
8081
},
@@ -236,8 +237,10 @@ export default {
236237
let toolbar = document.querySelector('.v-note-op');
237238
let curHeight = document.documentElement.scrollTop || document.body.scrollTop;
238239
if(curHeight >= 160){
240+
document.getElementById("placeholder").style.display="block"; //bad 用计算属性较好
239241
toolbar.classList.add("me-write-toolbar-fixed");
240242
}else{
243+
document.getElementById("placeholder").style.display="none";
241244
toolbar.classList.remove("me-write-toolbar-fixed");
242245
}
243246
}

0 commit comments

Comments
 (0)