Skip to content

Commit 0eb5b31

Browse files
committed
feat(vue editor): 初始化时计算滚动条默认居中
1 parent b8e8389 commit 0eb5b31

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

packages/demo/src/vue-editor/views/editor/Editor.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<div v-loading="loading" :class="{
3-
[$style.box]: true,
43
[$style.previewBox]: isPreview
54
}"
65
>
@@ -201,7 +200,8 @@
201200
mounted() {
202201
// todo: 通过计算获取
203202
window.document.body.classList.add('page-decorate-design');
204-
this.$refs.domScrollWrap.scrollLeft = 480;
203+
const scrollDom = this.$refs.domScrollWrap;
204+
this.$refs.domScrollWrap.scrollLeft = (scrollDom.scrollWidth - scrollDom.clientWidth) / 2;
205205
},
206206
destroyed() {
207207
window.document.body.classList.remove('page-decorate-design');

packages/demo/src/vue-editor/views/editor/EditorM.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<div v-loading="loading" :class="{
3-
[$style.box]: true,
43
[$style.previewBox]: isPreview
54
}"
65
>
@@ -17,7 +16,7 @@
1716
v-else
1817
type="primary"
1918
style="position: fixed;right: 20px;top: 20px;z-index: 5;"
20-
@click="(scale = 70) && (isPreview = false)"
19+
@click="isPreview = false"
2120
>
2221
结束预览
2322
</el-button>
@@ -309,7 +308,6 @@
309308
310309
// 用户操作数据
311310
handleDataChange() {
312-
// todo: ie 会导致输入框丢失光标
313311
this.fixComponentFormPosition();
314312
},
315313

0 commit comments

Comments
 (0)