npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@qingbing/ts-v3-json-editor

v2.1.8

Published

vite + ts + vue3 封装的 JsonEditor 插件

Downloads

7

Readme

JsonEditor 插件介绍

1. 概要说明

  • 参考地址: https://github.com/bestkolobok/vue3-jsoneditor

1.1 地址

https://gitee.com/duqingbing/ts-v3-package/tree/ts-v3-json-editor

1.2 插件描述

vite + ts + vue3 封装的 JsonEditor 插件

1.3 重要依赖

  • @qingbing/ts-v3-utils: ^2.0.15
  • vue: ^3.4.21
  • vue3-ts-jsoneditor: ^2.11.2

1.4 插件安装

# yarn 安装
yarn add @qingbing/ts-v3-json-editor

# npm 安装
npm i @qingbing/ts-v3-json-editor

2. 包说明

2.1 属性说明

| 属性名 | 类型 | 是否必需 | 默认值 | 意义 | | :----------------- | :----------------- | :------- | :----- | :-------------------------------------------------------- | | options | TJsonEditorOptions | 否 | {} | JsonEditor 的绑定参数, 参考 vue3-ts-jsoneditor 的绑定参数 | | modelValue | {jsonable} | 否 | "" | JsonEditor 编辑的 json 数据, 值为任意可 json 化的内容 | | disabledFullScreen | Boolean | 否 | false | 控制是否显示全屏按钮 |

  • options 详细说明
// vue3-ts-jsoneditor 插件的参数可以直接透传
type Mode = "text" | "tree" | "table";
interface JSONEditorOptions {
  readOnly?: boolean;
  indentation?: number | string;
  tabSize?: number;
  selection?: JSONEditorSelection;
  mode?: Mode;
  mainMenuBar?: boolean;
  navigationBar?: boolean;
  statusBar?: boolean;
  askToFormat?: boolean;
  escapeControlCharacters?: boolean;
  escapeUnicodeCharacters?: boolean;
  flattenColumns?: boolean;
  validator?: Validator;
  parser?: JSONParser;
  validationParser?: JSONParser;
  pathParser?: JSONPathParser;
  queryLanguagesIds?: QueryLanguageId[];
  queryLanguageId?: QueryLanguageId;
  onRenderValue?: OnRenderValue;
  onClassName?: OnClassName;
  onRenderMenu?: OnRenderMenu;
  height?: string | number;
  fullWidthButton?: boolean;
  darkTheme?: boolean;
}

2.2 事件说明

  • 参考 vue3-ts-jsoneditor 插件

2.3 实例暴露说明

| 属性名 | 类型 | | :----- | :--- | | - | 无 |

3. 示例

3.1 全局注册使用

  • 一旦注册, JsonEditor 作为组件全局通用
  • 使用方法参考 3.2 模板组件使用, 去掉组件导入的语句即可
// main.ts
import '@qingbing/ts-v3-json-editor/dist/style.css'
import { JsonEditorPlugin } from '@qingbing/ts-v3-json-editor'
app.use(JsonEditorPlugin, {
  name: 'JsonEditor',
  options: {}
})

3.2 模板组件使用

<template>
    <h1>Parent: {{ record }}</h1>
    <JsonEditor :options="options" v-model="record.data" />
    <JsonEditor :options="options2" v-model="record.data2" :disabled-fullscreen="disabledFullscreen" />
</template>

<script setup lang="ts">
import '@qingbing/ts-v3-json-editor/dist/style.css'
import type { TJsonEditorOptions } from "@qingbing/ts-v3-json-editor";
import { JsonEditor } from '@qingbing/ts-v3-json-editor' // 如果注册成了全局组件,这句将不再需要
import { reactive } from "vue";

const record = reactive({
    data: {
        array: [1, 2, 3],
        boolean: true,
        Null: null,
        number: 123,
        seconds: 0,
        object: { a: "b", c: "d" },
        string: "Hello World",
    },
    data2: {
        array: [1, 2, 3]
    },
});

const options: TJsonEditorOptions = {
    height: 500,
    mode: "text",
};
const options2: TJsonEditorOptions = {
    height: 400,
    mode: "text",
};
const disabledFullscreen = ref(true)
</script>