feat: tests with vue on html using CDN

This commit is contained in:
Amadeu José Andrade Junior
2025-01-09 10:54:23 -03:00
parent 0d6eca1319
commit 72f6ac55a4
3 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
const app = Vue.createApp({
data() {
return {
firstName: 'John',
lastName: 'Doe',
email: 'john@gmail.com',
gender: 'male',
picture: 'https://randomuser.me/api/portraits/men/10.jpg',
};
},
methods: {
async getUser() {
const res = await fetch('https://randomuser.me/api/');
const { results } = await res.json();
this.firstName = results[0].name.first;
this.lastName = results[0].name.last;
this.email = results.email;
this.gender = results[0].gender;
this.picture = results[0].picture.large;
},
},
});
app.mount('#app');