Vue数据格式化:JSON、HTML、XML数据的格式化显示

介绍

数据格式化编辑器: 方便你实现在线的数据格式化编辑与显示的工具。支持的数据格式包括:JSON、HTML、XML

源码工程地址:vue_data_editor

效果图

在这里插入图片描述

安装

由于源码未创建npm包,所以请手动下载工具源码使用,谢谢!~

使用方式

import VueDataEditor from './vue_data_editor'

export default {
  name: 'ace_index',
  data: () => ({
    json_value: "{\"q\":\"百度\",\"p\":false,\"g\":[{\"type\":\"sug\",\"sa\":\"s_1\",\"q\":\"百度翻译\"},{\"type\":\"sug\",\"sa\":\"s_2\",\"q\":\"百度地图\"},{\"type\":\"sug\",\"sa\":\"s_3\",\"q\":\"百度网盘\"},{\"type\":\"sug\",\"sa\":\"s_4\",\"q\":\"百度识图\"},{\"type\":\"sug\",\"sa\":\"s_5\",\"q\":\"百度新闻\"},{\"type\":\"sug\",\"sa\":\"s_6\",\"q\":\"百度视频\"},{\"type\":\"sug\",\"sa\":\"s_7\",\"q\":\"百度搜题\"},{\"type\":\"sug\",\"sa\":\"s_8\",\"q\":\"百度一下\"},{\"type\":\"sug\",\"sa\":\"s_9\",\"q\":\"百度手机卫士隐私保护专版\"},{\"type\":\"sug\",\"sa\":\"s_10\",\"q\":\"百度小说\"}],\"slid\":\"2268943525663350670\"}",
    xml_value: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><project xmlns=\"http://maven.apache.org/POM/4.0.0\"         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">    <build>        <plugins>            <plugin>                <groupId>org.mybatis.generator</groupId>                <artifactId>mybatis-generator-maven-plugin</artifactId>                <version>1.3.2</version>                <configuration>                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>                    <verbose>true</verbose>                    <overwrite>true</overwrite>                </configuration>            </plugin>        </plugins>    </build></project>",
    html_value: "<!DOCTYPE html><html>  <head>    <meta charset=\"utf-8\">    <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">    <title>kb-vue-components</title>  </head>  <body>    <div id=\"app\"></div>    <!-- built files will be auto injected -->  <script type=\"text/javascript\" src=\"/app.js\"></script></body></html>",
  }),
  render(h) {
    return h('div', {
      staticClass: 'q-pa-sm'
    }, [
      h('div', {
        staticClass: 'text-left text-tertiary font-14 text-weight-bold'
      }, [
        'JSON数据格式显示效果:'
      ]),
      h(VueDataEditor, {
        on: {
          input: (v) => {
            this.json_value = v
          }
        },
        props: {
          value: this.json_value,
          disable: false,
          width: '100%',
          height: '400px'
        }
      }),

      h('div', {
        staticClass: 'row no-wrap q-mt-md'
      }, [
        h('div', {
          staticClass: 'q-pr-sm',
          style: {
            width: '50%'
          }
        }, [
          h('div', {
            staticClass: 'text-left text-tertiary font-14 text-weight-bold'
          }, [
            'XML数据格式显示效果:'
          ]),
          h(VueDataEditor, {
            props: {
              value: this.xml_value,
              disable: true,
              height: '400px'
            }
          }),
        ]),
        h('div', {
          staticClass: 'q-pl-sm',
          style: {
            width: '50%'
          }
        }, [
          h('div', {
            staticClass: 'text-left text-tertiary font-14 text-weight-bold'
          }, [
            'HTML数据格式显示效果:'
          ]),
          h(VueDataEditor, {
            props: {
              value: this.html_value,
              disable: true,
              height: '400px'
            }
          })
        ])
      ])

    ])
  }
}


插件列表

插件地址:brace

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值