Views: 2922
Last Modified: 27.04.2022
Object.freeze
When data doesn't require a reactive behavior (i. e., for constants or language phrases), you need to create an unmodifiable object. This helps save resources of your app.
computed:
{
applicationConstants(state)
{
return Object.freeze({
const1: 'value 1',
const2: 'value 2'
})
}
}
v-for and element key
When using the cycles v-for
, always indicate the :key
. This allows template engine to correctly perform animations and optimizes DOM tree rendering when updating the data. Read more details in the article Use of Key in lists.
<template v-for="operator in operators" :key="operator.id">
<div class="imopenlines-user">
<div class="imopenlines-user-name">{{operator.name}}</div>
</div>
</template>