Skip to content

Instantly share code, notes, and snippets.

@bcernesto
Last active February 21, 2021 19:34
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 bcernesto/12e38e59815a947ceed5bb4d477a136a to your computer and use it in GitHub Desktop.
Save bcernesto/12e38e59815a947ceed5bb4d477a136a to your computer and use it in GitHub Desktop.
Sencillo reloj para mostrar el funcionamiento de Vue
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reloj con Vue</title>
</head>
<body>
<div id="app">
<h1>{{ titulo }}</h1>
<p>{{ texto }}</p>
<p>La hora actual es <span>{{ hora }}</span></p>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
var dateTimeFormat = new Intl.DateTimeFormat('es-ES', { timeStyle: 'medium' });
app = new Vue({
el: '#app',
data: {
titulo: 'Reloj',
texto: '¡Bienvenido!',
hora:''
}
});
setInterval(() => app.hora = dateTimeFormat.format(new Date()), 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment