Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to send varible to another page in nuxt.js

// page.js file in the store folder
const state = {
  name: ''
}

const mutations = {
    setName(state, name) {
    state.name = name
  }
}

const getters = {
  getName: (state) => state.name
}

export default {
  state,
  mutations,
  getters
}
Comment

how to send varible to another page in nuxt.js

// Page.vue page
<template>
  <div>Welcome</div>
</template>
<script>
  export default {
    layout: 'login',
    created() {
      this.$store.commit('page/setName', 'Hello')
    },
  }
</script>
Comment

how to send varible to another page in nuxt.js

<template>
  <div class="login-page">
    <div class="col1">{{ name }}</div>
    <div class="col2">
      <div class="content-box">
        <nuxt />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  computed: {
    name() {
      return this.$store.getters['page/getName']
    }
  }
}
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: Domafter injection bottom 
Javascript :: Arrow Function Shorthand javascript 
Javascript :: create immutable array in javascript 
Javascript :: Exponent Power Shorthand in javascript 
Javascript :: NestJs starter repo 
Javascript :: make a backend server in node 
Javascript :: javascript random number between 10 and 100 
Javascript :: server starter code in js 
Javascript :: create sub array from array with values that pass condition javascript 
Javascript :: change to a constant variable 
Javascript :: how to get node modules 
Javascript :: graphql get item by id from strapi react 
Javascript :: where to make the hooks functions 
Javascript :: btoa in js string only 
Javascript :: react computed hook 
Javascript :: javascript const scope = await angular.element(document.body).scope(); 
Javascript :: 4.6.3. Order of Operations&para; 
Javascript :: how to style svgs in react 
Javascript :: Solana SPL Token JavaScript library mint function 
Javascript :: typeorm sqlite Using Entity Manager 
Javascript :: sails sqlite3 
Javascript :: variable hoisting 
Javascript :: how to format date dd/mm/yyyy in javascript 
Javascript :: Block Alignment Toolbar Using ES5 in Wordpress 
Javascript :: hide header in next js page 
Javascript :: Determining Truth With Logical Operators 
Javascript :: django formdata use csrf token in js 
Javascript :: easyui datagrid scrollto 
Javascript :: react-navigation headerbackbutton not export member of navigation 
Javascript :: Discord.js v12 member voiceChannel 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =