Nuxt.js: Get Store in Vue filter rc3

Created on 31 Jul 2017  路  3Comments  路  Source: nuxt/nuxt.js

How can I get store object for Vue filter in plugins using rc3?

~/plugins/app.js

Vue.filter('translate', function (item, attribute) {
  return item[attribute][$store.state.foo] // Here
})

This question is available on Nuxt.js community (#c1085)

Most helpful comment

https://github.com/nuxt-community/modules/issues/89#issuecomment-318107891

import Vue from 'vue'

export default { store } => {
  Vue.filter('translate', (item, attribute) => {
    return item[attribute][store.state.foo]
  })
}

All 3 comments

https://github.com/nuxt-community/modules/issues/89#issuecomment-318107891

import Vue from 'vue'

export default { store } => {
  Vue.filter('translate', (item, attribute) => {
    return item[attribute][store.state.foo]
  })
}

Is multiple export possible or one plugin file has one default export?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uptownhr picture uptownhr  路  3Comments

bimohxh picture bimohxh  路  3Comments

vadimsg picture vadimsg  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments