vue.js 表单验证插件
原始模型 (vue-rawmodel)
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Vue.js v2的RawModel.js插件。 表单验证从未如此简单!
This plugin integrates RawModel.js framework into your Vue.js application.
该插件将RawModel.js框架集成到您的Vue.js应用程序中。
RawModel.js is a simple framework which provides a strongly-typed JavaScript object with support for validation and error handling. It has a rich API which significantly simplifies server-side and client-side data validation and manipulation. Because it's an unopinionated framework it flawlessly integrates with popular modules like vuex, apollo-client and other related libraries.
RawModel.js是一个简单的框架,它提供强类型JavaScript对象,并支持验证和错误处理。 它具有丰富的API,可大大简化服务器端和客户端的数据验证和操作。 由于它是一个不受限制的框架,因此可以完美地与流行的模块(如vuex,apollo-client和其他相关库)集成。
RawModel.js together with Vue.js represents a web framework on steroids. Thanks to its powerful and flexible model objects, a form validation has never been easier. This plugin brings even more elegant way to do form validation using RawModel.js and still leaves you freedom to customize and fine-tune the integration.
RawModel.js和Vue.js一起代表类固醇的Web框架。 由于其强大而灵活的模型对象,表单验证从未如此简单。 该插件带来了更原始的方式来使用RawModel.js进行表单验证,并且仍然使您可以自由定制和微调集成。
Make sure you check RawModel.js API page for details about the framework.
确保检查RawModel.js API页面以获取有关框架的详细信息。
This is a light weight open source package for Vue.js written with TypeScript. It's actively maintained and ready for production environments. The source code is available on GitHub where you can also find our issue tracker.
这是用TypeScript编写的Vue.js的轻量级开源软件包。 它已得到积极维护,并准备用于生产环境。 源代码在GitHub上可用,您还可以在其中找到我们的问题跟踪器。
Installation
安装
Run the command below to install the package.
运行以下命令以安装软件包。
$ npm install --save vue-rawmodel rawmodel
This package uses promises thus you need to use Promise polyfill when promises are not supported.
此软件包使用了Promise,因此当不支持Promise时,您需要使用Promise polyfill。
When used with a module system, you must explicitly install vue-rawmodel via Vue.use().
与模块系统一起使用时,必须通过Vue.use()显式安装vue-rawmodel。
import Vue from 'vue';
import VueRawModel from 'vue-rawmodel';
Vue.use(VueRawModel);
现场演示 (Live Demo)
翻译自: https://vuejsexamples.com/rawmodel-js-plugin-for-vue-js-v2-form-validation-has-never-been-easier/
vue.js 表单验证插件