0.1.6 • Published 4 years ago

@iroha1024/json-form v0.1.6

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

json-form

转换json与form,可编辑json的svelte ui组件

Installation

Install via npm:

npm i @iroha1024/json-form

Install via yarn:

yarn add @iroha1024/json-form

Usage

import { createForm, VaildJson } from "@iroha1024/json-form"

const jsonForm = createForm('#app') // or createForm(document.body)

createForm('#app', options)

const json: VaildJson = [{ key: { name: "键值", type: "string", value: "属性" } }]
const str = JSON.stringify(json)

createForm('#app', str)

createForm('#app', str, options)

Options

const options = {
    editable: true,
    style: {
        width: 800,
        height: 600,	// or 'auto'
        fontSize: 25,
        lineHeight: 1.6,
        padding: {	//单元格间距
            top: 10,
            right: 8,
        },
        background: 'none',	// or 'stripe'
    },
}

Instance method

通过实例方法可访问和修改jsonForm相关数据

methoddescriptionargument
setJson修改表格展示的json数据VaildJson
getJson获取json数据
setOptions修改设置DeepPartial<Options>
getOptions获取设置
0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago