Skip to content

CIcon "icon" not updating content #41

Open
@igoohd

Description

@igoohd

In my nuxt app when I have a case that I want to change the icon according to a ref, but, even if the prop of CIcon (icon) is changing it doesn't update the content and re-render CIcon with the new value.

<template>
  <span class="tw-ml-2 tw-self-center">
    <CIcon
      :icon="currentIcon"
      size="xl"
      class="tw-cursor-pointer !tw-text-gray-500 tw-select-none"
      @click="togglePasswordVisibility"
    />
  </span>
</template>

<script lang="ts" setup>
const emit = defineEmits(['toggleInputType'])

const isHidden = ref(true)

const currentIcon = computed(() => {
  return isHidden.value ? cilLockLocked : cilLockUnlocked
})

const togglePasswordVisibility = () => {
  isHidden.value = !isHidden.value
  emit('toggleInputType')
}
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions