https://gist.github.com/matinfo/52214f7f34ce6b746b483f0f92e6b5e5
авил плагин JQuery Redactor в компонент VUE. Плагин работает нормально, но мне нужен доступ к HTML, чтобы я мог видеть его в Vue.
Я перепробовал все, что мог придумать, методы, вычисленные свойства, но я не могу найти способ. Это особенно сложно, потому что Redactor добавляет новый HTML в дом, и мне нужно получить данные из добавленного HTML.
В настоящее время я получаю эту ошибку,this.$emit is not a function
, Мне нужно, чтобы получить значение HTML.redactor-editor
в реквизит, так что он будет доступен в данных VUE. ВарtextContent
правильно выводит на экран в консоли, но я не могу показать это вprop
, Любая помощь очень ценится.
Составная часть
<template>
<div>
<textarea class="form-control question-create-editor" id="question_description" placeholder="Go wild with all the details here - make image upload work" rows="3">
</div>
</template>
<script>
export default {
props: ['redactorValue'],
mounted: function(){
$('#question-create-form .question-create-editor').redactor({
imageUpload:'/urlGoesHereBro/',
plugins: ['video', 'imagemanager', 'counter', 'limiter'],
buttonsHide:['html', 'formatting', 'deleted', 'indent', 'outdent', 'alignment', 'horizontalrule']
});
},
computed: {
redactorValue: function(){
$('#question-create-form .redactor-editor').on('keyup', function(){
var textContent = $('#question-create-form .redactor-editor').html();
console.log( 'textContent = ' + textContent );
this.$emit('redactorValue', textContent);
});
}
}
};
HTML
<vueredactor></vueredactor>