vuex-orm-plugin-date-attribute

0.1.1 • Public • Published

Vuex ORM Plugin: Date Attribute

JavaScript Style Guide License

Installation

import VuexORM from '@vuex-orm/core'
import datePlugin from 'vuex-orm-plugin-date-attribute'

VuexORM.use(datePlugin)

Usage in Model Definition

// models/User.js
import { Model } from '@vuex-orm/core'

export default class User extends Model {
  static entity = 'users'

  static fields () {
    return {
      id: this.increment(),
      name: this.string(''),
      active: this.boolean(false),
      // Use plugged-in attribute creator Model.date() to create a field whose value will be a Date object.
      last_login: this.date(null),
      login_count: this.number(0),
    }
  }
}

Package Sidebar

Install

npm i vuex-orm-plugin-date-attribute

Weekly Downloads

53

Version

0.1.1

License

MIT

Unpacked Size

9.12 kB

Total Files

8

Last publish

Collaborators

  • smnscp