在vue的裏面利用ckeditor進行光標插入短代碼

<script src="<?=Yii::$app->request->baseUrl?>/js/ckeditor/ckeditor.js"></script>vue

<textarea name="editor1" id="editor1" rows="10" cols="80"></textarea>app

1 必定要在vue的created方法裏面初始化ckeditorblog

     created:function(){
            Vue.nextTick(function () {
                CKEDITOR.replace('editor1',{
                    height:350,
                    width:680,
                });
            });
        },ip

2 插入短代碼get

  insert_tag:function(myValue){
                // Get the editor instance that we want to interact with.
                var oEditor = CKEDITOR.instances.editor1;
                // Check the active editing mode.
                oEditor.insertText( myValue );
            },it

3 獲取內容io

    var content = CKEDITOR.instances.editor1.getData();function

4 設置內容request

   var content = CKEDITOR.instances.editor1.setData();方法

 

相關文章
相關標籤/搜索