@netsells/nuxt-non-pojo
v1.3.0
Published
A way to use non-POJO class instances in NuxtJS
Downloads
3
Keywords
Readme
Nuxt Non-POJO
Use non-POJO objects in NuxtJS with server side rendering.
Usage
Add a plugin:
plugins: [
'~/plugins/nuxt-non-pojo',
],
// plugins/nuxt-non-pojo.js
import Vue from 'vue';
import createPlugin from '@netsells/nuxt-non-pojo';
import { Foo, Bar } from '../models';
export default createPlugin(Vue, {
classes: [Foo, Bar],
});
Save an object in data
// With NuxtJS context
app.$nnp.save(foo);
// In a component
this.$nnp.save(foo);
Read an object from data
this.$nnp(foo)
Add a class after plugin registered
this.$nnp.register(Foo);