代码之家  ›  专栏  ›  技术社区  ›  Saud Qureshi

在vue.js中设置编辑器高度[重复]

  •  1
  • Saud Qureshi  · 技术社区  · 6 年前

    我在试 ckeditor5 在Vue.js中,我遇到了无法手动设置其高度的问题,下面是我的代码。如果我做错了什么,请告诉我。

    <ckeditor :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
    
    data() {
            return {
                editor: Editor,
                editorData: '',
                editorConfig: {
                    height: '500px'
                }
            }
    
    1 回复  |  直到 4 年前
        1
  •  9
  •   user8555937    5 年前

    Classic editor(CKEditor 5)不再将编辑区域封装在中,这意味着可以使用CSS轻松控制编辑区域的高度(和类似选项)。例如,可以通过以下方式实现高度设置:

    <style>
      .ck-editor__editable {
        min-height: 500px;
       }
    </style>
    

    .ck-content { height:500px; }.
    

    2020年注: 使用单页Vue组件时,不要限定要添加到ckeditor的CSS的范围,因为它的元素与Vue分开呈现,并且没有向它们添加数据属性。换句话说,, 不要 请执行此操作,因为它不起作用:

    <style scoped> /* don't add "scoped"; note that this will also globalize the CSS for all editors in your project */
        .ck-editor__editable {
            min-height: 5000px;
        }
    </style>