Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@netsells/nuxtjs-page-store

Package Overview
Dependencies
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netsells/nuxtjs-page-store

Store global data for a page which is cleared after changing page

latest
npmnpm
Version
1.0.0
Version published
Maintainers
8
Created
Source

NuxtJS Page Store

A page data store which clears itself down between pages using nuxt middleware. Useful for passing data from the page to the layout.

Installation

yarn add @netsells/nuxtjs-page-store

Usage

This module is built on top of Vuex for reactivity.

Add to your nuxt config:

    modules: [
        '@netsells/nuxtjs-page-store',
    ],

set

Set the data object, is merged with existing data

this.$store.commit('pageStore/set', {
    title: 'Homepage',
    subtitle: 'Foo bar',
})

clear

Clear all the page data. Is called internally between pages

this.$store.commit('pageStore/clear');

getters


import { mapGetters } from 'vuex';

export default {
    name: 'my-layout',

    computed: {
        ...mapGetters('pageStore', ['get']),
    },
};

And in your template:

<div>
    <h1>{{ get('title') }}</h1>
    <h2>{{ get('subtitle') }}</h2>
    <nuxt />
</div>

FAQs

Package last updated on 05 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts