jQuery plugin in Vue component: Cannot pass value to prop

前端 未结 3 754
盖世英雄少女心
盖世英雄少女心 2020-12-11 10:36

I have added the jquery redactor plugin in a vue component. The plugin is working fine but I need to access the html so I can see it in Vue.

I have tried everything

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 11:23

    The this.$emit is not a function issue is because this is pointing to the window.

    Also I moved the keyup definition into mounted.

    export default {
        data(){
            return {
                redactorValue: null
            }
        },
        mounted: function(){
              $('#question-create-form .question-create-editor').redactor({
                imageUpload:'/urlGoesHereBro/',
                plugins: ['video', 'imagemanager', 'counter', 'limiter'],
                buttonsHide:['html', 'formatting', 'deleted', 'indent', 'outdent', 'alignment', 'horizontalrule']
              });
    
              $('#question-create-form .redactor-editor').on('keyup', function(){
                  this.redactorValue = $('#question-create-form .redactor-editor').html();
              }.bind(this));
        }
    };
    

提交回复
热议问题