Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
- <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
- <title>Index page</title>
- </head>
- <body>
- <div id="root">
- {{ topics }}
- </div>
- <script>
- new Vue({
- el: "#root",
- data: {
- topics: []
- },
- mounted() {
- axios.get('/topics')
- .then(function(response) {
- alert(response.data[0].heading)
- this.topics = response.data
- })
- .catch(function(error) {
- console.log(error)
- });
- }
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement