Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
8
Weekly downloads
 
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc