Question 30
Consider the below application with markup “index.html” and javascript file “app.js”.
index.html:
<body> <div id="app"></div> <scriptsrc="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> <script src="app.js" type="module"></script> </body>app.js:
const Player = { template: `<div style='background-color:red'><slot></slot></div>`, data() { return { scores: [ { name: 'Rohit', run: 20 }, { name: 'Virat', run: 50 }, ], } },}
new Vue({ el: '#app', template: `<div> <h1> Score Board</h1> <Player> <ol type='1'> <li v-for='score in scores'>{{score.name}}:{{score.run}}</li> </ol> </Player> </div>`, data: { scores: [ { name: 'Rohit', run: 50 }, { name: 'Virat', run: 20 }, ], }, components: { Player, },})Suppose you open the file “index.html” in a browser. What will be rendered inside the slot, by the browser?