Vue
by MoruoFrog
HTML
<div id="app">
<p>It's {{ firstUser.name }}'s show time</p>
<div>total: {{ total }}</div>
</div>
Vue
const user = []
let i = 0
while (i++ < 50000) {
user.push(`kun_${i}`, i)
}
new Vue({
el: "#app",
data: {
userList: user,
},
computed: {
firstUser() {
const userList = this.userList
return userList.length ? { name: userList[0], id: userList[1] } : {}
},
total() {
return this.userList.length / 2
},
},
})