提交 66f6a726 authored 作者: wangjiahao's avatar wangjiahao

fix:文本框组件,格式框有时不显示问题

上级 c427e548
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<div v-if="editMode == 'edit'" class="v-text" @keydown="handleKeydown" @keyup="handleKeyup"> <div v-if="editMode == 'edit'" class="v-text" @keydown="handleKeydown" @keyup="handleKeyup">
<!-- tabindex >= 0 使得双击时聚集该元素 --> <!-- tabindex >= 0 使得双击时聚集该元素 -->
<div <div
v-if="canEdit"
ref="text" ref="text"
:contenteditable="canEdit" :contenteditable="canEdit"
:class="{ canEdit }" :class="{ canEdit }"
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
@input="handleInput" @input="handleInput"
v-html="element.propValue" v-html="element.propValue"
/> />
<div v-if="!canEdit" :style="{ verticalAlign: element.style.verticalAlign }" @dblclick="setEdit" v-html="element.propValue" />
</div> </div>
<div v-else class="v-text"> <div v-else class="v-text">
<div :style="{ verticalAlign: element.style.verticalAlign }" v-html="element.propValue" /> <div :style="{ verticalAlign: element.style.verticalAlign }" v-html="element.propValue" />
...@@ -110,6 +112,10 @@ export default { ...@@ -110,6 +112,10 @@ export default {
setEdit() { setEdit() {
this.canEdit = true this.canEdit = true
// // // 聚焦到单元格
// setTimeout(() => {
// this.$refs['text'].focus()
// }, 500)
// 全选 // 全选
this.selectText(this.$refs.text) this.selectText(this.$refs.text)
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论