mazipan / vue-currency-filter

🍒 Lightweight vue currency filter based on accounting.js
https://mazipan.github.io/vue-currency-filter/
MIT License
247 stars 29 forks source link

BUG: Nuxt config not allowing multiple configurations #201

Open Soviut opened 4 years ago

Soviut commented 4 years ago

I'm using vue-currency-filter in Nuxt and wanted to have two configurations; The default to show dollars and cents, and another to show just dollars.

However, using the configuration example in the README for multiple configs did not seem to register the filters correctly.

A simplified version of my nuxt.config.js

export default {
  modules: [
    ['vue-currency-filter/nuxt', [
      {
        // default name 'currency'
        symbol: '$',
        thousandsSeparator: ',',
        fractionCount: 2,
        fractionSeparator: '.',
        symbolPosition: 'front',
        symbolSpacing: false,
      },
      {
        name: 'dollars',
        symbol: '$',
        thousandsSeparator: ',',
        fractionCount: 0,
        fractionSeparator: '.',
        symbolPosition: 'front',
        symbolSpacing: false,
      },
    ],
  ],
}
{{ 1000 | currency }}

Yielded a value of 1.000, meaning it was using the default config.

{{ 1000 | dollars }}

Threw an error

[Vue warn]: Failed to resolve filter: dollars

mazipan commented 4 years ago

cc: @SysaIvan

mazipan commented 4 years ago

Kindly help to check @Soviut , already fix by @SysaIvan