自学内容网 自学内容网

YOLO v5 Series - JSON Editor

在这里插入图片描述
JSON Editor

    <link href="css/jsoneditor.css" rel="stylesheet" type="text/css"/>

    <div id="jsoneditor" style="height:100%;border: solid 0px #0FAC81;"></div>

    <script src="./js/jsoneditor.js?ver=2.2.0"></script>

Demand

var container = document.getElementById('jsoneditor');
var editor = null;
    var triggerDemand = function() {
        var timerInterval, bofTime = 0, eofTime = 0;

        bofTime = timeStamp();
        Swal.fire({
            title: 'Loading',
            timer: 300,
            showConfirmButton: false,
            timerProgressBar: true,
            onBeforeOpen: function onBeforeOpen() {
                Swal.showLoading();
                $.ajax({
                    type: 'GET',
                    url: '/api/redis/dictionary/list?master=' + myToken + '&' + tsTail(),
                    contentType: 'application/json; charset=utf-8',
                    data: {},
                    success: function(data) {
                        var alpha = JSON.parse(data);
                        if (editor) {
                            editor.destroy();
                        }
                        editor = new JSONEditor(container, {mode: 'view'});
                        if (editor) {
                            $('.jsoneditor').css('border', 'solid 0px green');
                            $('.jsoneditor-menu').addClass('hide');
                            $('.jsoneditor-navigation-bar').addClass('hide');
                        }
                        editor.set(alpha);
                        editor.expandAll();
                    },
                    error: function(data) {
                    }
                });

                timerInterval = setInterval(function () {}, 100);
            },
            onClose: function onClose() {
                clearInterval(timerInterval);
            }
        }).then(function (result) {
        });
    };

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


原文地址:https://blog.csdn.net/unix2linux/article/details/145165664

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!