Created
August 16, 2019 22:24
-
-
Save parzibyte/6284e46b7be9e089360f84ef26b38686 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
// 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