nuxt中引入tinymce编辑器

Vue项目实战:TinyMCE富文本编辑器的深度定制与优化 本文深入探讨了在Vue项目中深度定制与优化TinyMCE富文本编辑器的实战方案。内容涵盖核心配置、插件动态加载、自定义业务插件开发、样式深度定制、大型文档性能优化及与Vue生态的集成技巧,旨在帮助开发者将TinyMCE打造成高度贴合业务需求的专属内容生产工具。 阅读详情
起因

Nuxt.js是一个服务端渲染框架。在一开始项目中使用的是quill.js编辑器,因其支持服务端渲染,但后期其功能过于少,故选择了非常强大的tinymce编辑器。

本文首发于: http://zhanghaoran.ren

正文
  • 安装tinymce
npm i @tinymce/tinymce-vue tinymce  -s
  • 在~/static/目录下创建tinymce文件夹,下载完tinymce后在node_modules 中找到 tinymce/skins目录,将其复制到static/tinymce目录。

  • 下载中文语言包。
    下载解压后,把langs文件夹放到~/static/tinymce/下。
    zhanghaoran前端

  • 在~/components/下创建 tinymceEditor.vue文件。

template

<template>
    <client-only>
        <editor id="tinymce" v-model="contents" :init="init"></editor>
     </client-only>
</template>

script

	import editor from '@tinymce/tinymce-vue';
    import toolbar from "./toobar";		// toolbar
    import plugins from "./plugins";	// plugins
    import {imageHost} from "../../../plugins/host";

    let tinymce;
	// 在客户端环境下引入
    if (process.client) {
        tinymce = require('tinymce/tinymce');
        require('tinymce/themes/silver');
        require('tinymce/icons/default');
        require('tinymce/plugins/image');// 插入上传图片插件
        require('tinymce/plugins/media');// 插入视频插件
        require('tinymce/plugins/table');// 插入表格插件
        require('tinymce/plugins/lists');// 列表插件
        require('tinymce/plugins/link');//超链接插件
        require('tinymce/plugins/wordcount');// 字数统计插件
        // require('tinymce/plugins/emoticons');// 插入表情插件
        require('tinymce/plugins/fullscreen');
        require('tinymce/plugins/code');
        require('tinymce/plugins/paste');
        require('tinymce/plugins/advlist');
        require('tinymce/plugins/autolink');
        require('tinymce/plugins/autosave');
        require('tinymce/plugins/codesample');
        require('tinymce/plugins/colorpicker');
        require('tinymce/plugins/contextmenu');
        require('tinymce/plugins/directionality');
        require('tinymce/plugins/nonbreaking');
        require('tinymce/plugins/insertdatetime');
        require('tinymce/plugins/preview');
        require('tinymce/plugins/print');
        require('tinymce/plugins/save');
        require('tinymce/plugins/searchreplace');
        require('tinymce/plugins/spellchecker');
        require('tinymce/plugins/tabfocus');
        require('tinymce/plugins/table');
        require('tinymce/plugins/template');
        require('tinymce/plugins/textcolor');
        require('tinymce/plugins/visualblocks');
        require('tinymce/plugins/textpattern');
        require('tinymce/plugins/visualchars');
        require('tinymce/plugins/wordcount');
        require('tinymce/plugins/anchor');
        require('tinymce/plugins/hr');
        require('tinymce/plugins/link');
        require('tinymce/plugins/noneditable');
        require('tinymce/plugins/pagebreak');
    }
    export default {
        name: "tinymce-editor",
        components:{editor},
		// 接收引用此组件的值
        props: ['modifyContent'],
        data() {
            return {
				// 图片地址前缀
                imageHost:imageHost(),
                //初始化配置
                init: {
                    language_url: '/tinymce/langs/zh_CN.js',// 语言包的路径
                    language: 'zh_CN',//语言
                    skin_url: '/tinymce/skins/ui/oxide',// skin路径
                    height: 800,//编辑器高度
                    branding: false,//是否禁用“Powered by TinyMCE”
                    menubar: true,//顶部菜单栏显示
                    object_resizing: false,// 是否禁用表格图片大小调整
                    autosave_ask_before_unload:false,	// 去除关闭/刷新网页时弹出对话框
                    plugins: plugins,
                    toolbar: toolbar,
                    body_class: "panel-body ",
                    end_container_on_empty_block: true,
                    powerpaste_word_import: "clean",
                    code_dialog_height: 450,
                    code_dialog_width: 1000,
                    advlist_bullet_styles: "square",
                    advlist_number_styles: "default",
                    imagetools_cors_hosts: ["www.tinymce.com", "codepen.io"],
					// 自定义字体集
                    theme_advanced_fonts:
                        "宋体=宋体;微软雅黑=微软雅黑;新宋体=新宋体;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n",
					// 自定义字号
                    fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt",
                    content_css:'/tinymce/skins/content/default/content.css',
                    paste_data_images: true, // 允许粘贴图像
					// 自定义字体
                    font_formats: `
            微软雅黑=微软雅黑;
            宋体=宋体;
            黑体=黑体;
            仿宋=仿宋;
            楷体=楷体;
            隶书=隶书;
            幼圆=幼圆;
            思源黑体CN=思源黑体CN;
            Andale Mono=andale mono,times;
            Arial=arial, helvetica,
            sans-serif;
            Arial Black=arial black, avant garde;
            Book Antiqua=book antiqua,palatino;
            Comic Sans MS=comic sans ms,sans-serif;
            Courier New=courier new,courier;
            Georgia=georgia,palatino;
            Helvetica=helvetica;
            Impact=impact,chicago;
            Symbol=symbol;
            Tahoma=tahoma,arial,helvetica,sans-serif;
            Terminal=terminal,monaco;
            Times New Roman=times new roman,times;
            Trebuchet MS=trebuchet ms,geneva;
            Verdana=verdana,geneva;
            Webdings=webdings;
            Wingdings=wingdings,zapf dingbats`,
                    content_style: `
            *                         { padding:0; margin:0; }
            html, body                { height:100%; }
            img                       { max-width:100%; display:block;height:auto; }
            a                         { text-decoration: none; }
            iframe                    { width: 100%; }
            p                         { line-height:1.6; margin: 0px; font-size: 16px; font-family:微软雅黑}
            table                     { word-wrap:break-word; word-break:break-all; max-width:100%; border:none; border-color:#999; }
            .mce-object-iframe        { width:100%; box-sizing:border-box; margin:0; padding:0; }
            ul,ol                     { list-style-position:inside; }
            body, td, pre {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
}
          `,
                    style_formats: [
                        {
                            title: "首行缩进",
                            block: "p",
                            styles: { "text-indent": "2em" }
                        },
                        {
                            title: "行高",
                            items: [
                                { title: "1", styles: { "line-height": "1" }, inline: "span" },
                                {
                                    title: "1.5",
                                    styles: { "line-height": "1.5" },
                                    inline: "span"
                                },
                                { title: "2", styles: { "line-height": "2" }, inline: "span" },
                                {
                                    title: "2.5",
                                    styles: { "line-height": "2.5" },
                                    inline: "span"
                                },
                                { title: "3", styles: { "line-height": "3" }, inline: "span" }
                            ]
                        }
                    ],
                    default_link_target: "_blank",
                    link_title: false,
                    convert_urls: false, // 图片上传路径为绝对路径
                    remove_script_host: false,
                    paste_word_valid_elements: "*[*]",
                    paste_convert_word_fake_lists: false,
                    paste_webkit_styles: "all",
                    paste_merge_formats: true,
                    nonbreaking_force_tab: false,
                    paste_auto_cleanup_on_paste: false,
                    forced_root_block: "p",
                    force_p_newlines: true,
                    importcss_append: true,
                    tabfocus_elements: ":prev,:next",
                    // 本地图片上传配置
                    images_upload_handler: (blobInfo, success, failure) => {
                        let params = new FormData();
                        params.append("image", blobInfo.blob());
                        this.$axios.post("/upload_image?random="+Math.random(), params)
                            .then(res=>{
                                if(res.data.code == 0){
                                    success( this.imageHost + res.data.data)
                                } else {
                                    failure("上传失败")
                                }
                            })
                            .catch(()=>{
                                failure("上传失败")
                            })
                    },
                    setup: (editor) => {
						// 监听编辑器失焦事件
                        var _this = this;
                        editor.on('blur', function () {
                            _this.$emit('saveDraft')
                        })
                    },
                },
				// 绑定的内容
                contents: this.modifyContent
            }
        },
        mounted(){ // 用process.client判断一下环境再执行
            this.$nextTick(()=>{
                if (process.client) {
                    window.tinymce.init({});
                }
            })
        },
        watch: {
            modifyContent(newValue) {
                this.contents = newValue
            },
            contents(newValue) {
                this.$emit('writeContent', newValue);
            }
        }
    }
  • 引用
<template>
	<div class="postEditor">
		<tinymceEditor @writeContent="getWriteContent" v-if="isShowEdit"  @saveDraft="saveDraft"/>
	</div>
</template>

<script>
    import tinymceEditor from "../../components/public/tinymceEditor/tinymce-editor"
	
	 export default {
        name: "write",
        middleware: 'auth',		// 登录验证中间件
        components: {tinymceEditor},
        data() {
            return {
				isShowEdit:true,
				articleContent: '',
			}
		},
		method:{
			// 同步编辑器数据
            getWriteContent(content) {
                this.articleContent = content;
            },
			// 保存草稿
			saveDraft(){
				console.log("保存草稿")
			}
		}

至此,以上配置已经满足我的使用了。
最核心的就是:nuxt.js是服务端渲染。 tinymce编辑器在客户端渲染就好了,和正常vue内引用使用一样。


有问题随时联系邮箱: manbanzhen@qq.com

本文首发于: http://zhanghaoran.ren

别再手动汉化了!TinyMCE 6.x 中文语言包(zh_CN.js)一键配置全攻略 本文详细介绍了TinyMCE 6.x中文语言包(zh_CN.js)的高效配置方法,包括CDN快速集成、NPM模块化集成和本地化定制方案,帮助开发者告别手动汉化的低效时代。文章还提供了框架深度整合实战和高级性能优化技巧,确保TinyMCE编辑器在Vue、React等现代前端项目中实现无缝中文支持。 阅读详情

相关推荐

vue3 - 详细实现安装引入tinymce富文本编辑器教程,并且在编辑器里内置markdown编辑器,支持富文本转换为markdown语法并且解析显示,vue集成tinymce和markdown插件

vue3,nuxt3,tinymce,富文本编辑器,markdown,编辑器,vue3 引入tinymce详细教程,vue3引入markdown编辑器详细教程,如何让两个语法的编辑器同时存在,vue3集成Tinymce富文本和markdown编辑器,vue3 中使用 TinyMCE 富文本编辑器,互相切换,同时内置两种编辑器,转换,所见所得,vue3项目中使用markdown编辑器(v-md-editor),让用户自己选择用哪个编辑器,富文本内容可以转成markdown内容吗,vue3实现富文本转mark

✅ 精选推荐文章 4182

nuxt.js中引入tinymce并封装成组件使用(亲测有用)

nuxt版本如下: "nuxt": "^2.15.7" 注:本文引入的富文本编辑没有引入图片上传插件,如需引入则参考其他博文进行引入。 1.引入tinymce依赖 本人尝试引用过最新版本的tinymce依赖,但不知道为啥引入的时候会报依赖错误,故经常尝试,引入如下版本的依赖: npm install @tinymce/tinymce-vue@2.1.0 tinymce@5.3.2 2.在项目工程中的components目录下创建文件tinymce-editor,如下: 3.在创建的tinymce-ed

我有一根魔法棒的博客 2798

MATLAB实战:用Costas环和Gardner环搞定QPSK同步问题(附完整代码)

本文详细介绍了如何使用MATLAB实现Costas环和Gardner环联合解决QPSK同步问题,包括载波同步和定时同步的技术原理、MATLAB代码实现及性能分析。通过完整的仿真示例和工程实践建议,帮助读者掌握QPSK同步技术的核心要点,提升数字通信系统的解调性能。

agile9scrum的博客 691

在 Nuxt 中使用 tinymce 富文本编辑器

在 Nuxt 中使用 tinymce 富文本编辑器

qq_49487356的博客 1970

保姆级避坑指南:在Ubuntu 22.04上用ROS2 Humble搞定TurtleBot3的SLAM与导航(附5个常见报错解决方案)

本文提供了一份详细的Ubuntu 22.04上使用ROS2 Humble和TurtleBot3进行SLAM建图与导航的避坑指南,涵盖Gazebo启动失败、场景加载问题、环境变量设置、GLIBCXX版本冲突及Nav2参数配置等5个常见报错的解决方案,帮助开发者高效完成机器人导航项目。

weixin_29062823的博客 285

信贷审批中的那些坑:从零开始搭建风控策略体系的5个关键步骤

本文深入探讨了信贷审批中的风控策略体系搭建,从数据陷阱识别、规则冲突诊断到反欺诈攻防,提供了5个关键步骤的实战指南。重点解析了如何通过特征工程、决策树优化和模型可解释性技术,构建动态平衡的风控体系,有效降低逾期风险并提升审批效率。

weixin_29253711的博客 412

Nuxt 使用tinymce插件

一、原因 tinymce插件是一个很好的编辑器,vue兼容使用也很方便,但是改nuxt框架后使用方式有点不同,网上大多数说的方法都是从module拷贝文件,然后自建component,可是这种方式太麻烦了, 简单点其实也可以用,下面来介绍一下吧二、步骤 1、安装tinymce 或者在package.json添加 然后npm install进行安装 2、创建plugin在plugins文件夹下创建一个tinymce.js文件 3、引入pl

ethan的博客 1388

eNSP-Pro配置又丢了?手把手教你用导出功能防患于未然

本文详细介绍了eNSP-Pro配置防丢失的全套方案,包括运行时内存、虚拟存储设备和宿主机文件系统的配置存储机制,以及多维度备份策略和特殊场景下的恢复技巧。通过优化保存流程、自动化定时导出和版本化管理,帮助网络工程师有效防止配置丢失,提升工作效率。

weixin_42665725的博客 241

当TinyMCE富文本编辑器遇到Vue3+nuxt+ts项目,分享引入成功案例及过程中踩的那些坑

如果你的前端项目技术栈使用的是Vue3+nuxt+ts,并且老大让你集成一下那个传说中非常丝滑的TinyMCE富文本编辑器,那么恭喜你和我一样中大奖了。网上找了好久都没有找到同类型且靠谱的实现方案,于是就自己着手研究文档并踩着坑解决了。TinyMCE中文文档中文手册懒得看过程的直接跳到最下方复制组件源码后按自己项目微调即可。

vvv3171071的博客 1197

从.bib到.bbl:手把手教你搞定LaTeX参考文献的完整流程

本文详细介绍了从.bib到.bbl的LaTeX参考文献处理完整流程,包括文献数据库构建、样式选择、主文档配置、编译流程及问题排查。特别针对.bib、.bbl等文件的操作提供了实战解决方案,帮助用户高效管理学术文献引用,适用于各类学术写作场景。

weixin_29292431的博客 285

六、Tool 工具系统:让大模型拥有“手脚“

我问你一个问题:大模型能不能告诉你"北京今天天气怎么样"?能——它能用非常流畅的中文回答你不能——它不知道这个答案因为它没有联网能力,也没有实时数据。它可能会自信地编一个"今天晴,25 度"给你——这就是幻觉。问题出在哪?大模型是一个"推理引擎",不是一个"执行引擎"。它知道天气 API 怎么调用,但不能真的发出 HTTP 请求。它知道 Python 代码怎么写,但不能真的运行代码。它知道数学公式,但做不了精确的大数计算。Tool 工具系统解决的,就是这个"最后一公里"问题。

牛肉胡辣汤 157

nuxt 使用 tinymce 富文本编辑器

nuxt 使用 tinymc 富文本编辑器 1、安装 npm i / yarn add @tinymce/tinymce-vue@2.1.0 tinymce@5.3.2 2、代码结构 <template> <client-only> <div class="tinymce-editor"> <editor v-if="!reloading" v-model="myValue" :init="init" :disabled="disabled

qq_44767646的博客 1458

【YOLOv8科研级优化】基于YOLOv9的GELAN模块重构C2f结构,实现精度与效率的同步提升

打开确保模型解析器能识别GELANBlock模块。通过将YOLOv9的GELAN模块集成到YOLOv8的C2f模块中,我们实现了一个“强特征表达+高效计算”的目标检测模型。这个改进不仅在工程上能提升复杂场景下的检测效果,更在科研上提供了“多分支特征融合”的创新思路——这种思路可以延伸到其他检测网络(如Faster R-CNN、SSD)的改进中,帮你在论文中打造独特的研究点。

know_F0727的博客 203

vue中引用tinymce图标不显示解决方法

vue中引用tinymce图标不显示解决方法 通过官网查到一篇博客,按照上面步骤可以实现tinymce富文本编辑器的封装和使用。https://www.cnblogs.com/zhongchao666/p/11142537.html在node_modules里面找到tinymce,将skins目录复制到public/tinymce里面(vue) 在node_modules里面找到tinymce,将skins目录复制到static/tinymce里面(nuxt) 由于公司需要使用nuxt.js,再次使.

一片天空 4838

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

nuxt引入tinymce遇到navigator,以及其他的一些坑

nuxt使用tinymce富文本,出现的坑

木子的博客 952

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Vue中使用TinyMCE

Nuxt.js 插件配置tinymce.client.ts。在 Vue 组件中使用全局配置editor.vue。TinyMCE 全局配置文件tinymce.ts。Nuxt 页面中使用全局配置。

Web开发者 636

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

nuxt.js常见问题总结

最近在开发我司一项目,用的是nuxt.js开发的,nuxt版本号:2.14.8。 主要记录一下,我在这个项目中一些用到的东西吧,地址:http://www.lawlawing.com/ 感觉基本包含了nuxt.js的大部分配置了。 安装 第一种办法: 此方法可参考我的这篇文章:初识nuxt.js 我的npm 下载太慢了,所以用了第二种办法 npx create-nuxt-app <project-name> 文档:https://nuxtjs.org/docs/2.x/configurati

zhanghaoran 3849

NUXT.JS企业级应用实战:内容管理系统开发

平台内置的NUXT.JS模板快速生成了基础项目结构,省去了配置环境的时间。SEO方面,利用NUXT的head方法动态设置页面标题和meta标签,特别针对文章详情页做了关键词和描述的优化。为了性能考虑,对大数据集做了分页和懒加载处理。每个问题我们都通过分析NUXT的运行机制找到了合理解决方案,比如使用keep-alive配合路由meta控制缓存,对富文本内容做客户端only渲染等。最近在做一个企业级内容管理系统(CMS)的前端开发,选择了NUXT.JS作为技术栈,整个过程收获不少实战经验,分享给大家参考。

BlackironLynx23的博客 841

TinyMCE下载及使用

1、TinyMCE下载 官方下载网址:http://www.tinymce.com/ 简体中文语言包下载:http://www.tinymce.com/i18n/index.php?ctrl=lang&amp;act=download&amp;pr_id=1 2、下载包中示例 代码: &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; ...

weixin_33909059的博客 358

vue 富文本存储_vue 富文本编辑器 项目实战用法

1.挑个富文本编辑器首先针对自己项目的类型,确定自己要用啥编辑器。1.1 wangeditor如果一般类似博客这种项目不需要花里胡哨的,功能也不要求贼多的,推荐一下wangeditor(点击跳转)。能覆盖基本上所有的常见操作,轻量化,开源,有中文文档。▽wangeditor效果图1.2 tinyMCE如果需要复杂的编辑器,推荐tinyMCE(点击跳转),同样也非常简单和优雅,但是文档是英文的,配合...

weixin_39678531的博客 277

推荐一篇好博文 vue的富文本编辑器 包括如何在nuxt用

http://www.fly63.com/nav/2051

wenjinrong的博客 301

Vue常用的组件库大全【前端工程师必备】【实时更新】【移动端、PC端(web端)、数据可视化组件库(数据大屏) 、动画组件库、富文本、Markdown,3D组件库,Markdown,AI组件库

Vue组件库,超100个Vue组件库,Vue常用的组件库大全【前端工程师必备】【实时更新】【移动端、PC端(web端)、数据可视化组件库(数据大屏) 、动画组件库、文本编辑器,富文本Markdown,3D组件库】

程序员猫爪 3万+

html编辑器:tinymce 3.0 发布

声明:lupa开源社区刊登此文只为传递信息,并不表示赞同或者反对。

320
上一篇: nuxt.js中按需加载 element-ui遇到的问题
下一篇: Ubuntu安装/卸载node,npm
慢半帧
博客等级 码龄8年 14粉丝 40原创
评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值