Created
July 16, 2020 12:45
-
-
Save Lunberg88/a3acee97b3fa98d3b7bf414f08ec1b16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @/lang/index.js | |
const numberFormats = { | |
'en': { | |
currency: { | |
style: 'currency', | |
currency: 'CHF' | |
} | |
}, | |
'de': { | |
currency: { | |
style: 'currency', | |
currency: 'EUR' | |
} | |
}, | |
'fr': { | |
currency: { | |
style: 'currency', | |
currency: 'EUR' | |
} | |
}, | |
'ch': { | |
currency: { | |
style: 'currency', | |
currency: 'CHF' | |
} | |
}, | |
'it': { | |
currency: { | |
style: 'currency', | |
currency: 'EUR' | |
} | |
} | |
}; | |
// @/lang/numeralLocales | |
export const registerNumeric = (val) => { | |
const locale = getLangCode(); | |
return i18n.n(val, 'currency', locale.toLowerCase() || 'en'); | |
}; | |
// main.ts | |
Vue.prototype.$numeral = registerNumeric; | |
// @/components/X.vue | |
methods: { | |
totalPrice(val) { | |
return this.$numeral(val); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment