Question 10
Consider the following Vue app with markup index.html and JavaScript app.js.
index.html
<body> <div id="app"></div></body>app.js
const Dashboard = { template: `<div> This is dashboard for {{user.name}} </div>`, props: ['id'], data() { return { users: [ { id: 1, name: 'User1' }, { id: 2, name: 'User2' }, { id: 3, name: 'User3' }, ], } }, computed: { user() { const user = this.users.find((user) => user.id == this.id) if (user) { return user } else { return this.users[2] } }, },}
const router = new VueRouter({ routes: [{ path: '/dashboard/:id', component: Dashboard, props:true }],})new Vue({ el: '#app', template: `<router-view />`, router,})Suppose the application is running on “http://localhost:8080” . What will be rendered inside the router-view component of root component for the URL “http://localhost:8080/dashboard/1” ?
This is dashboard for User1
This is dashboard for User2
This is dashboard for User3
None of these