feat: tests with vue on html using CDN
This commit is contained in:
24
random-user-generator/app.js
Normal file
24
random-user-generator/app.js
Normal 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');
|
||||
Reference in New Issue
Block a user