Last active
February 21, 2021 19:34
-
-
Save bcernesto/12e38e59815a947ceed5bb4d477a136a to your computer and use it in GitHub Desktop.
Sencillo reloj para mostrar el funcionamiento de Vue
This file contains hidden or 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
<!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