关于本站
“最难不过坚持”
本人承接扒站仿站,php网站维护,病毒查杀,网站编辑,网站改版,html制作
有需要网站维护,改版,病毒查杀,网站编辑,网站备案,html制作等相关的工作可以联系我。
本人有多年相关工作经验,也可提供免费咨询,交个朋友。
有需要探讨问题的朋友,也可以加我微信,共同探讨!
微信:15011482830 QQ:408917339
2682
39
分类目录
最新评论
- https://jueru.net/
-
- :weixiao:
-
- :shuijiao: :weiqu: :zhenbang: :leng:
-
- :yiwen: :yiwen: :yiwen: :yiwen:
-
- 这个业务逻辑多少都有点奇怪了,阅读浏览次数增值在新闻详情页的控制器方法里setInc,这怎么还写进模型事件里了。如果非要用onAfterRead也可以,把新闻文章的内容单独分出来一个news_content表,然后把它和news做关联,然后给news_content表的onAfterRead事件做增值处理,这样点进新闻页内查询到文章内容时才会触发它。
-
文章标签更多
打开边栏(ESC)
关闭边栏(ESC)
vue中使用kindeditor富文本编辑器
第一步,下载依赖
npm i kindeditor第二步,建立kindeditor组件src\components\Kindeditor\index.vue
<template> <div class="kindeditor"> <textarea :id="id" name="content" v-model="outContent"></textarea> </div> </template> <script> import 'kindeditor/kindeditor-all.js' import 'kindeditor/lang/zh-CN.js' import 'kindeditor/themes/default/default.css' export default { name: 'kindeditor', data () { return { editor: null, outContent: this.content, } }, props: { content: { type: String, default: '' }, id: { type: String, required: true }, width: { type: String }, height: { type: String }, minWidth: { type: Number, default: 650 }, minHeight: { type: Number, default: 100 }, items: { type: Array, default: function () { return [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about' ] } }, noDisableItems: { type: Array, default: function () { return ['source', 'fullscreen'] } }, filterMode: { type: Boolean, default: true }, htmlTags: { type: Object, default: function () { return { font: ['color', 'size', 'face', '.background-color'], span: ['style'], div: ['class', 'align', 'style'], table: ['class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'style'], 'td,th': ['class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', 'style'], a: ['class', 'href', 'target', 'name', 'style'], embed: ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', 'style', 'align', 'allowscriptaccess', '/'], img: ['src', 'width', 'height', 'border', 'alt', 'title', 'align', 'style', '/'], hr: ['class', '/'], br: ['/'], 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6': ['align', 'style'], 'tbody,tr,strong,b,sub,sup,em,i,u,strike': [] } } }, wellFormatMode: { type: Boolean, default: true }, resizeType: { type: Number, default: 2 }, themeType: { type: String, default: 'default' }, langType: { type: String, default: 'zh-CN' }, designMode: { type: Boolean, default: true }, fullscreenMode: { type: Boolean, default: false }, basePath: { type: String, default: process.env.VUE_APP_HOST + '/public' }, themesPath: { type: String }, pluginsPath: { type: String, default: '' }, langPath: { type: String }, minChangeSize: { type: Number, default: 5 }, loadStyleMode: { type: Boolean, default: true }, urlType: { type: String, default: '' }, newlineTag: { type: String, default: 'p' }, pasteType: { type: Number, default: 2 }, dialogAlignType: { type: String, default: 'page' }, shadowMode: { type: Boolean, default: true }, zIndex: { type: Number, default: 811213 }, useContextmenu: { type: Boolean, default: true }, syncType: { type: String, default: 'form' }, indentChar: { type: String, default: '\t' }, cssPath: { type: [ String, Array ] }, cssData: { type: String }, bodyClass: { type: String, default: 'ke-content' }, colorTable: { type: Array }, afterCreate: { type: Function }, afterChange: { type: Function }, afterTab: { type: Function }, afterFocus: { type: Function }, afterBlur: { type: Function }, afterUpload: { type: Function }, uploadJson: { type: String, default: process.env.VUE_APP_HOST + '/admin/base/editorUpload', }, fileManagerJson: { type: Function }, allowPreviewEmoticons: { type: Boolean, default: true }, allowImageUpload: { type: Boolean, default: true }, allowFlashUpload: { type: Boolean, default: true }, allowMediaUpload: { type: Boolean, default: true }, allowFileUpload: { type: Boolean, default: true }, allowFileManager: { type: Boolean, default: true }, fontSizeTable: { type: Array, default: function () { return ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'] } }, imageTabIndex: { type: Number, default: 0 }, formatUploadUrl: { type: Boolean, default: true }, fullscreenShortcut: { type: Boolean, default: false }, extraFileUploadParams: { type: Array, default: function () { return [] } }, filePostName: { type: String, default: 'imgFile' }, fillDescAfterUploadImage: { type: Boolean, default: false }, afterSelectFile: { type: Function }, pagebreakHtml: { type: String, default: '<hr style=”page-break-after: always;” class=”ke-pagebreak” />' }, allowImageRemote: { type: Boolean, default: true }, autoHeightMode: { type: Boolean, default: false }, fixToolBar: { type: Boolean, default: false }, tabIndex: { type: Number } }, watch: { content (val) { this.editor && val !== this.outContent && this.editor.html(val) }, outContent (val) { this.$emit('update:content', val) this.$emit('on-content-change', val) } }, mounted () { var _this = this _this.editor = KindEditor.create('#' + this.id, { width: _this.width, height: _this.height, minWidth: _this.minWidth, minHeight: _this.minHeight, items: _this.items, noDisableItems: _this.noDisableItems, filterMode: _this.filterMode, htmlTags: _this.htmlTags, wellFormatMode: _this.wellFormatMode, resizeType: _this.resizeType, themeType: _this.themeType, langType: _this.langType, designMode: _this.designMode, fullscreenMode: _this.fullscreenMode, basePath: _this.basePath, themesPath: _this.cssPath, pluginsPath: _this.pluginsPath, langPath: _this.langPath, minChangeSize: _this.minChangeSize, loadStyleMode: _this.loadStyleMode, urlType: _this.urlType, newlineTag: _this.newlineTag, pasteType: _this.pasteType, dialogAlignType: _this.dialogAlignType, shadowMode: _this.shadowMode, zIndex: _this.zIndex, useContextmenu: _this.useContextmenu, syncType: _this.syncType, indentChar: _this.indentChar, cssPath: _this.cssPath, cssData: _this.cssData, bodyClass: _this.bodyClass, colorTable: _this.colorTable, afterCreate: _this.afterCreate, afterChange: function () { _this.afterChange _this.outContent = this.html() }, afterTab: _this.afterTab, afterFocus: _this.afterFocus, afterBlur: _this.afterBlur, afterUpload: _this.afterUpload, uploadJson: _this.uploadJson, fileManagerJson: _this.fileManagerJson, allowPreviewEmoticons: _this.allowPreviewEmoticons, allowImageUpload: _this.allowImageUpload, allowFlashUpload: _this.allowFlashUpload, allowMediaUpload: _this.allowMediaUpload, allowFileUpload: _this.allowFileUpload, allowFileManager: _this.allowFileManager, fontSizeTable: _this.fontSizeTable, imageTabIndex: _this.imageTabIndex, formatUploadUrl: _this.formatUploadUrl, fullscreenShortcut: _this.fullscreenShortcut, extraFileUploadParams: _this.extraFileUploadParams, filePostName: _this.filePostName, fillDescAfterUploadImage: _this.fillDescAfterUploadImage, afterSelectFile: _this.afterSelectFile, pagebreakHtml: _this.pagebreakHtml, allowImageRemote: _this.allowImageRemote, autoHeightMode: _this.autoHeightMode, fixToolBar: _this.fixToolBar, tabIndex: _this.tabIndex }) } } </script> <style> </style>第三步,引入使用
<template> <div id="app"> <!-- 添加编辑对话框 --> <el-dialog :title="$t('common')[dialogMode]" center :visible.sync="dialogFormVisible"> <el-form ref="form" class="matter-form" :rules="rules" :model="temp" label-position="right" label-width="140px"> <el-form-item :label="$t('common.content')" prop="aboutContent"> <editor id="editor_id" height="500px" width="100%" :content.sync="temp['aboutContent']" :loadStyleMode="false"></editor> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="dialogFormVisible = false">{{ $t('common.close') }}</el-button> <el-button :loading="saveLoading" type="primary" @click="handleSubmit">{{ $t('common.save') }}</el-button> </div> </el-dialog> </div> </template> <script> import editor from './components/kindeditor.vue' export default { name: 'app', components: { editor }, data () { return { } }, methods: { } } </script>效果如下:
原文章链接:https://www.cnblogs.com/ldlx-mars/p/11881242.html
注意:以上工作做完,可以编辑文字了,如果想上传图片,会有错误,涉及跨域的问题,参考
修改好kindeditor-all.js,解决图片上传跨域问题之后,相对于原文章,需要修改,图片上传接口
图片url返回后,拼接的主域名
然后就可以上传图片了。
多图上传,flash上传,视频上传,文件上传,不能用,可以删除
赏


相关推荐
接口返回request failed with status code 500错误
接口返回request failed with status code 500错误
登录界面,验证账号密码成功,但是返回500错误
可能原因:linux服务器,用tp5搭建的后台及接口,会生成一部分缓存文件,但是linux默认没有权限创建数据,所以,只要在缓存文件夹runtime添加写的权限即可
解决errors and 0 warnings potentially fixable with the `--fix` option.问题
解决errors and 0 warnings potentially fixable with the `--fix` option.问题
项目正常运行,就是有这个提示
找到.eslintrc.js注释掉// 'eslint:recommended'
评论加载中...