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

vue-compat-form-editor

v1.1.3

Published

个性化表单配置 `Vue`

Downloads

38

Readme

vue-compat-form-editor

个性化表单配置 Vue

Get Started 起步

0. Install 安装

$ yarn add vue-compat-form-editor

check that the dependency has been installed. 确认依赖已安装。

$ npx cf-editor --version

# or

$ npx cf-editor --help

1. Eject files 弹出文件

$ npx cf-editor eject <path/to/your/static/folder>

e.g.

$ npx cf-editor eject public

you will find x-editor folder in the public folder. 你将会在 public 目录下找到编译好的 x-editor 文件夹。

2. Import components 导入组件

import { XEditor, XRenderer } from "vue-compat-form-editor";

new Vue({
  components: {
    XEditor,
    XRenderer
  }
});

Then, use in template. 然后再模板中使用

<template>
  <x-editor v-model="config" :url="url" @preview-errors="onPreviewErrors" />
  <x-renderer :config="config" :url="url" />
</template>

XEditor 编辑器

XEditor Attributes 属性

| 参数 | 说明 | 类型 | 可选值 | 默认值 | |:-----------:|:-----------:|:-----------:|:-----------:|:-----------:| | url | 访问到静态文件 x-editor/editor.html 的路径。其内部实现依靠 <iframe> 标签,是 <iframe>src 属性 | string | - | - | | v-model | 表单配置,随着编辑器不断编辑表单配置,表单配置是动态变化的 | object, 具体类型为 FormConfig | - | - |

XEditor Events 事件

| 事件名称 | 说明 | 回调参数 | |:-----------:|:-----------:|:-----------:| | preview-errors | 编辑器内部有 编辑预览 的切换,当在预览时出现校验错误时,发射此事件 | 一个包含错误信息的数组,具体类型为 Array<{ name: string, errors: string[] }> |

XRenderer 渲染器

XRenderer Attributes 属性

| 参数 | 说明 | 类型 | 可选值 | 默认值 | |:-----------:|:-----------:|:-----------:|:-----------:|:-----------:| | url | 访问到静态文件 x-editor/renderer.html 的路径。其内部实现依靠 <iframe> 标签,是 <iframe>src 属性 | string | - | - | | config | 表单配置,渲染器会根据这个配置进行表单的渲染工作 | object, 具体类型为 FormConfig | - | - |

XRenderer Instance Methods 实例方法

| 方法名 | 说明 | 函数类型 | |:-----------:|:-----------:|:-----------:| | submit | 外部触发表单验证,同时获取结果 result。表单的值可以通过 result.values 拿到。如果出现校验出现错误,获取的 result.errors 是一个数组,且此时拿不到表单的值,即 result.values === undefined | () => Promise<{ values?: any; errors?: Array<{ path: string; messages: string[] }>; }> | | reset | 重置表单状态。可选两个参数 forceClear (强制更新) 和 noValidate (为 true 时也会重置表单校验状态至最初状态)。 | (forceClear?: boolean, noValidate = false) => Promise<void> |