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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@opentiny/tiny-schema-renderer

v1.0.0-beta.6

Published

基于 json-schema 的运行时渲染器

Downloads

284

Readme

@opentiny/tiny-schema-renderer

基于 json-schema 的运行时渲染器

前置条件

运行时渲染器底层基于 [email protected] 并且内置了 TinyVue 组件库,所以要在工程中安装 @opentiny/vue@opentiny/vue-theme@opentiny/vue-iconvue 依赖。

安装(vue3 工程)

npm i @opentiny/tiny-schema-renderer @opentiny/vue @opentiny/vue-theme @opentiny/vue-icon --save

使用方式一

当作 vue 组件直接使用

<template>
  <SchemaRenderer :schema="schema"></SchemaRenderer>
</template>

<script setup>
import SchemaRenderer from "@opentiny/tiny-schema-renderer";

const schema = {
  state: {},
  methods: {},
  componentName: "Page",
  props: {},
  children: [
    {
      componentName: "Text",
      props: {
        text: "运行时渲染器",
      },
    },
  ],
  fileName: "TinySchemaRenderer",
};
</script>

使用方式二

当作 webcomponents 标签使用

1、创建 card.ce.vue

<template>
  <SchemaRenderer :schema="schemaObj"></SchemaRenderer>
</template>

<script setup>
import SchemaRenderer from "@opentiny/tiny-schema-renderer";
import { computed } from "vue";

const props = defineProps({
  schema: {
    type: String,
    required: true,
    default: () => "",
  },
});

const schemaObj = computed(() => {
  return JSON.parse(props.schema);
});
</script>
<style>
@import url("@opentiny/vue-theme/index.css");
</style>

2、创建 web-component.js 引入 card.ce.vue 注册自己的 webcomponents 标签

import Card from "./components/card.ce.vue";
import { defineCustomElement } from "vue";

// 将 Vue 组件转为自定义元素类。
export const CardElement = defineCustomElement(Card);

// 记得在浏览器中注册元素类。
customElements.define("schema-card", CardElement);

3、在入口文件 mian.js 中加载 web-component.js

import { createApp } from "vue";
import App from "./App.vue";
import "./web-components";

createApp(App).mount("#app");

4、使用方式

可以在 html 文档中随意使用自定义标签渲染 schema

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>运行时渲染器</title>
  </head>
  <body>
    <schema-card
      schema='{state: {},methods: {},componentName: "Page",props: {},children: [{ componentName: "Text",props: {text: "运行时渲染器"}}]}'
    ></schema-card>
  </body>
</html>