Professional Documents
Culture Documents
js Tutorial:
How to Create
Vue.js App in 5
Minutes?
This content was originally published at
https://www.blog.duomly.com/vue-js-tutorial-how-to-create-vue-js-app-in-5-
minutes/
***
Let’s start!
Let’s do it!
3. Start a project
After creating a new project is done, you
will see further instructions on what to
do to start the app.
yarn serve
Or
<template>
<h3> Users:</h3>
</template>
<script>
export default {
name: 'Users',
}
</script>
<style>
h3 {
margin-bottom: 5%;
}
</style>
<template>
<div id="app">
<Users />
</div>
</template>
<script>
import Users from './components/Users.vue'
export default {
name: 'app',
components: {
Users
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-
serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
or
<script>
import axios from 'axios';
export default {
name: 'Users'
}
</script>
<script>
import axios from 'axios';
export default {
name: 'Users',
data() {
return {
users: null,
};
},
created: function() {
axios
.get('https://
jsonplaceholder.typicode.com/users')
.then(res => {
this.users = res.data;
})
}
}
</script>
6. Display the data
It’s the time to use Bootstrap to create
a nice, simple template. Let’s go to ./
public folder to update an index.html
file.
<!DOCTYPE html>
<html lang="en">
<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">
<link rel="icon" href="<%= BASE_URL
%>favicon.ico">
<link rel="stylesheet" href="https://
stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/
bootstrap.min.css" integrity="sha384-
ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/
iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
<title>tutorial</title>
</head>
<body>