0.4.9 • Published 3 years ago
vue-kindeditor v0.4.9
vue-kindeditor
2021/01/17 修复,当未设置header参数时报错
2020/12/30 更新 props 增加 header,结构为对象 作用:可增加header,后端验证,防止上传接口被攻击
示例:
<editor id="editor_id" height="500px" width="700px" :content="editorText"
pluginsPath="/static/kindeditor/plugins/"
:loadStyleMode="false"
@on-content-change="onContentChange"
:header="header"></editor>
参数格式:header: { key: value }
需修改kindeditor-all.js kindeditor-all.js文件的4539行,修改了_ajax函数,添加了header. 6909行
var header=self.header;
K.ajax(K.addParam(fileManagerJson,param + '&' + new Date().getTime()), function(data) {
dialog.hideLoading();
func(data);
},header);
此功能由用户 @liqz2009 提供
依赖 vue 2 kindeditor 4
License
MIT License
安装
yarn add vue-kindeditor
使用
import Vue from 'vue'
import App from './App'
import router from './router'
import VueKindEditor from 'vue-kindeditor'
import 'kindeditor/kindeditor-all-min.js'
import 'kindeditor/themes/default/default.css'
Vue.config.productionTip = false
/* eslint-disable no-new */
Vue.use(VueKindEditor)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})
<template>
<div id="hello">
<h1>vue-kindedtior demo</h1>
<editor id="editor_id" height="500px" width="700px" :content="editorText"
:afterChange="afterChange()"
pluginsPath="/static/kindeditor/plugins/"
:loadStyleMode="false"
@on-content-change="onContentChange"></editor>
<editor id="editor_id2" height="500px" width="700px" :content="editorText"
:afterChange="afterChange()"
pluginsPath="/static/kindeditor/plugins/"
:loadStyleMode="false"
@on-content-change="onContentChange2"></editor>
</div>
</template>
<script>
export default {
name: 'hello',
data () {
return {
editorText: '',
editorText2: ''
}
},
created () {
},
methods: {
onContentChange (val) {
this.editorText = val
},
onContentChange2 (val) {
this.editorText2 = val
},
afterChange () {
}
}
}
</script>
<style>
#hello {
float: left;
}
</style>
初始化参数
演示
最近更新
重新打包。