div contenteditable="true" 新增placehoder效果

BloggerSb發表於2024-03-05

<div class="contain" :style="{height: editableHeight + 'px'}"
v-html="innerText"
ref="editableDiv"
contenteditable="true"
:placeholder=placeholder
@input="inputText"
@blur="inputBlur"
@focus="inputFocus">

.contain {
width: 100%;
padding: 3px;
border: 1px solid #DCDFE6;
border-radius:4px;
font-size: 12px;
overflow-x: hidden;
overflow-y: auto;
}
.contain:empty::before {
content: attr(placeholder);
color: grey;
}

相關文章