TextJson json 文本转换框

用于 Json 数据的标准转换

TextJson 示例

>{}
<template>
  <div>
    <TextJson
      v-model="the.body"
      placeholder="请输入json"
      rows="15"
      @onEvent="onEvent"
    />
  </div>
</template>

<script>
export default {
  setup(props, context) {
    // 使用外挂方式引入,具体查看demo
    const $plus = window.$plus;
    const { reactive } = $plus.vue;

    const the = reactive({
      body: { a: 1, b: 2, c: 'test' },
    });

    const onEvent = (resp) => {
      console.log('json', resp);
    };

    return { the, onEvent };
  },
};
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

TextJson Props

属性说明类型默认值
v-model双向绑定数据String-
placeholder占位字符String-
rows文本框的行数Number-
format 0.4.2初始内容是否格式化显示Booleanfalse
named 0.4.2组件命名Stringjson

TextJson onEvent

  • 点击转换时触发
参数名说明类型
cmdjsonUpdate:更新内容触发,error:错误触发,clear:清除Boolean
named 0.4.2组件命名String
type 0.4.2组件初始传入值类型,String,ObjectString
data转换之后的事件数据String
format是否格式化显示为 stringBoolean
event组件触发对象Boolean
messageerror 错误提示String

Last Updated: