Ueditor百度富文本的使用,取值,赋值,清空等操作

Github 地址:http://github.com/fex-team/ueditor
文档地址:http://fex.baidu.com/ueditor/#start-start
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ueditor百度富文本</title>
</head>
<style>

</style>

<body>
    <div id='app'>
        <script id="screenshots" name="screenshots" type="text/plain"></script>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6/dist/vue.min.js"></script>
<script charset="utf-8" src="__PUBLIC__/common/ueditor/ueditor.config.js"></script>
<script charset="utf-8" src="http://cdn.suoluomei.com/common/js/ueditor/ueditor.all.js"></script>
<script>
    var Vue = new Vue({
        el: '#app',
        data: {

        },
        created() {

        },
        mounted() {
            this.editor = UE.getEditor('screenshots', {
                autoHeightEnabled: false,//限制高度不随内容撑高
                wordCount: false, //是否开启字数统计
                maximumWords: 100000000, //允许的最大字符数
                toolbars: [ //头部的配置项,可不设置,将会显示全部
                    [
                        'anchor', 'undo', 'redo', 'bold', 'indent', 'italic', 'underline', 'strikethrough', 'subscript',
                        'superscript', 'formatmatch', 'removeformat', 'fontfamily', 'fontsize', 'attachment', 'simpleupload', 'insertimage',
                        'link', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify',
                    ]
                ]
            });
            this.editor.ready(function () {
                this.setHeight(300); //设置高度
            })
        },
        methods: {

        }
    })
</script>

</html>

取值,赋值,清空等

UE.getEditor('screenshots').setContent('xxx'); //赋值
UE.getEditor('screenshots').getContent(); //取值
UE.getEditor('screenshots').setContent('', false);//清空内容

百度文本编辑器的toolbars属性值描述
https://blog.csdn.net/zhengtingvae/article/details/52679591

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值