VueJs proper way to keep template clean without sacrificing performance

Our team is facing a problem with too much logics in template file which causes colleagues hard to debug.

I am thinking a proper way to increase the readability of the template file without losing performance.

Our team often include inline bitwise logic for dynamic class, style, etc. to fulfill the business logic under component template.


[Inline bitwise example]

<template> <!--Inline bitwise way-->
  <div class="listContainer">
    <div :class="`listItem ${_item.type == '1' ? 'itemTypeOne' : ''} ${_item.type == '2' ? 'itemTypeTwo' : ''}`" v-for="_item in list" :key="_item.key">
      <div class="itemBg" :style="{top: _item.type == '1' ? '10px' : '20px'}"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      list: [{key: "1", type: "1", value: "Value 1"}, { key: "2", type: "2", value: "Value 2"}],
    };
  },
  methods: {},
  computed: {},
}
</script>

To reduce these kind of logic code, I thought of using computed approach but I think it would cause computation overhead (Just in my opinion, feel free to correct me if I was wrong:)). It is because we cannot avoid using parameters with computed which lose the advantage of cache handled by vue itself. By using computed property with parameter approach, the parametrize anonymous function inside computed is keep being called which would potentially cause lower performance.


[Parametrized computed example]

<template>
  <div class="listContainer">
    <div :class="`listItem ${getItemClass(_item.type)}`" v-for="_item in list" :key="_item.key">
      <div class="itemBg" :style="getItemBgStyle(_item.type)"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      list: [{key: "1", type: "1", value: "Value 1"}, { key: "2", type: "2", value: "Value 2"}],
    };
  },
  methods: {},
  computed: {
    getItemClass: function(){
      return function($itemType){
        console.log("getItemClass called"); /* Keep being called even _item.key didnt changed */
        if($itemType == '1'){
          return 'itemTypeOne'
        }
        if($itemType == '2'){
          return 'itemTypeTwo'
        }
      }
    },
    getItemBgStyle: function(){
      return function($itemType){
        console.log("getItemClass called"); /* Same as getItemClass */
        return {
          top: $itemType == '1' ? '10px' : '20px'
        }
      }
    }
  },
}
</script>

Same with parametrized computed approach, parametrized method approach also cause this drawback. To keep this question in short, I’m not showing method approach here since it basically same with the computed approach. Here is the reference post that I studied: Can I pass parameters in computed properties in Vue.Js

My question is, is there a proper way to meet my aim (to keep template shorts without losing performance)?

Additionally, could anyone share with us the performance comparison between [Inline bitwise approach] vs [Parametrized computed approach] vs [Parametrized method approach].