We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for fields static method
fields
http://aliolicode.com/2016/05/07/typescript-static-members/
https://github.com/xpepermint/vue-rawmodel/blob/master/src/models.ts#L29
public constructor (data: ReactiveModelRecipe = {}) { super(data); // ... let clazz = this.constructor; fields = fields || typeof clazz.fields === 'function' ? clazz.fields() : clazz.fields if (fields) this.defineFields(fields) }
import {ReactiveModel} from 'vue-rawmodel'; class User extends ReactiveModel { constructor (data = {}) { super(data); // initializing parent class } static fields() { return { name: { type: 'String', // setting type casting validate: [{ validator: 'presence', // validator name message: 'is required' // validator error message } ] } }; } }
Equivalent to calling
constructor (data = {}) { super(data); // initializing parent class this.defineField({ // ... } }
The text was updated successfully, but these errors were encountered:
A note on the side: 😄
If "ReactiveModel" is a fitting name, it (or VueReactiveModel) is sexier than VueRawModel. 😉
Scott
Sorry, something went wrong.
vue-class-component is an official companion library that allows you to declare components as native JavaScript classes, with a @component decorator.
Based on this quote from the official Vue.js documentation, I decided to add decorator support. Coming soon ...
decorator
xpepermint
No branches or pull requests
Allow for
fields
static methodhttp://aliolicode.com/2016/05/07/typescript-static-members/
https://github.com/xpepermint/vue-rawmodel/blob/master/src/models.ts#L29
Equivalent to calling
The text was updated successfully, but these errors were encountered: