Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 16, 2019 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/6284e46b7be9e089360f84ef26b38686 to your computer and use it in GitHub Desktop.
Save parzibyte/6284e46b7be9e089360f84ef26b38686 to your computer and use it in GitHub Desktop.
// Registrar el filtro
Vue.filter("dinero", (valor, signo) => {
// Si no hay valores regresamos una cadena vacía
if (!valor || !signo) return "";
let valorConDecimales = valor.toFixed(2);
return signo + "" + valorConDecimales.toString();
});
// Dentro de la instancia no es necesario declararlo
// pues ya está registrado globalmente
new Vue({
el: "#app",
data: () => ({
total: 1750.6558
}),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment