feat: 评论区支持高度调整

This commit is contained in:
Tim
2025-07-25 10:57:29 +08:00
parent f5447604d6
commit 0cf44c2a42
4 changed files with 9 additions and 5 deletions

View File

@@ -57,7 +57,9 @@ body {
/************************* /*************************
* Vditor 自定义皮肤覆写 * Vditor 自定义皮肤覆写
*************************/ *************************/
.vditor {
min-height: 200px;
}
/* .vditor { /* .vditor {
--textarea-background-color: transparent; --textarea-background-color: transparent;
border: none !important; border: none !important;
@@ -200,6 +202,10 @@ body {
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.vditor {
min-height: 100px;
}
.vditor-toolbar { .vditor-toolbar {
display: none; display: none;
} }

View File

@@ -26,7 +26,6 @@ import {
getPreviewTheme as getPreviewThemeUtil getPreviewTheme as getPreviewThemeUtil
} from '../utils/vditor' } from '../utils/vditor'
import LoginOverlay from './LoginOverlay.vue' import LoginOverlay from './LoginOverlay.vue'
import { isMobile } from '../utils/screen'
export default { export default {
name: 'CommentEditor', name: 'CommentEditor',
@@ -74,7 +73,6 @@ export default {
onMounted(() => { onMounted(() => {
vditorInstance.value = createVditor(props.editorId, { vditorInstance.value = createVditor(props.editorId, {
placeholder: '说点什么...', placeholder: '说点什么...',
height: isMobile.value ? 'auto' : 200,
preview: { preview: {
actions: [], actions: [],
markdown: { toc: false } markdown: { toc: false }

View File

@@ -14,7 +14,6 @@ export function getPreviewTheme() {
export function createVditor(editorId, options = {}) { export function createVditor(editorId, options = {}) {
const { const {
placeholder = '', placeholder = '',
height,
preview = {}, preview = {},
input, input,
after after
@@ -22,7 +21,7 @@ export function createVditor(editorId, options = {}) {
return new Vditor(editorId, { return new Vditor(editorId, {
placeholder, placeholder,
height, height: 'auto',
theme: getEditorTheme(), theme: getEditorTheme(),
preview: Object.assign({ theme: { current: getPreviewTheme() } }, preview), preview: Object.assign({ theme: { current: getPreviewTheme() } }, preview),
cdn: 'https://openisle-1307107697.cos.ap-guangzhou.myqcloud.com/assert/vditor', cdn: 'https://openisle-1307107697.cos.ap-guangzhou.myqcloud.com/assert/vditor',

View File

@@ -795,6 +795,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
width: 100%;
} }
.info-content-header { .info-content-header {