在vue中kindeditor编辑器怎么实现发送功能?
<template>
<div>
<form id='create_topic_form' action='' method='post'>
<span class="tab-selector">选择版块:</span>
<select name="" id="tab-value">
<option value="">请选择</option>
<option value="">分享</option>
<option value="">问答</option>
</select>
</form>
<textarea autofocus id='title' name='title' rows='1' placeholder="标题字数 10 字以上"></textarea>
<div class="title_editor">
<editor id="editor_id" height="500px" width="98%"
:content.sync="editorText"
:afterChange="afterChange()"
pluginsPath="../../static/kindeditor/plugins/"
:loadStyleMode="false"
@on-content-change="onContentChange">
</editor>
<!-- <div> editorTextCopy: {{ editorTextCopy }} </div> -->
<div class='editor_buttons'>
<input type="submit" class='span-primary submit_btn' data-loading-text="提交中" value="发布">
</div>
</div>
</div>
</template>
<script>
export default{
components:{
forum_header,
},
name:'Issue_topic',
data(){
return{
editorText: '', // 双向同步的变量
editorTextCopy: '', // content-change 事件回掉改变的对象
}
},
methods: {
onContentChange (val) {
this.editorTextCopy = val;
console.log(this.editorTextCopy)
},
release(){
var oContentBox = document.getElementById('contentBox');
var oEditor_id = document.getElementById('editor_id');
var oTitle = document.getElementById('title');
var oShareAnswer = document.getElementById('shareAnswer');
var oChoose = document.getElementById('choose');
if(oEditor_id.value == ''){
alert('内容不可为空');
}else if(oTitle.value == ''){
alert('标题不可为空')
}
else if(oShareAnswer.value == oChoose.value){
alert('必须选择一个版块')
}else{
oContentBox.innerHTML = oContentBox.innerHTML + oShareAnswer.value + oTitle.value + oEBditor_id.value;
oEditor_id.value = '';
}
},
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论