Home > Mobile >  i Get a "Property type does not exist on type boolean" error when i try to do an inline te
i Get a "Property type does not exist on type boolean" error when i try to do an inline te

Time:06-17

The error Property type does not exist on type boolean shows on the show.value boolean

when I try to apply the text for the icon based on the truthiness

<template>

<div  @click="dropdown">
    <span>Purchase Requsition</span>
    <span >
{{show.value ? 'arrow_circle_down' : 'arrow_circle_down' }}     </span>
</div>

</template>

<script setup lang="ts">
import { ref } from "vue";

const show = ref<boolean>(false)

function dropdown(){
   show.value = !show.value
}
</script>

<style scoped>

</style>

CodePudding user response:

You should use show instead of show.value in your template. show.value is only available within the script tag in the composition api.

<template>

<div  @click="dropdown">
    <span>Purchase Requsition</span>
    <span >
      {{show ? 'arrow_circle_down' : 'arrow_circle_down' }}
    </span>
</div>

</template>
  • Related