Question 16
Consider the below application with markup “index.html” and JavaScript file “app.js”.
Filename: index.html
<body> <div id="app"></div> <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> <script src="https://unpkg.com/vue-router@3.0.0/dist/vue-router.js"></script> <script src="app.js"></script></body>Filename: app.js
const records = { 1: {albums: "Heartrisers", songs: 20, genre: 4}, 2: {albums: "Pianobind", songs: 13, genre: 5} }
const notFound = { template: `<h1>Unknown record!</h1>` }const myRecords = { template: `<h1>{{record.albums}} has {{record.songs}} songs across {{record.genre}} genres.</h1>`, data() { return {record: records[this.$route.params.id]} }, }
const router = new VueRouter({routes: [ { path: '/records/:id', component: myRecords }, { path: '*', component: notFound },],})
new Vue({el: '#app',template: '<div><router-view /></div>',router,})Suppose the application is running on “http://127.0.0.1:8080”, select the correct option(s)?