0

I'm testing out PrimeVue. Created a simple timestamp template that is being imported and displayed in the main App.vue template. See the following code. timestamp and local_timestamp show up correctly in the template. However, the tooltip is not working. If I use a string instead of the computed property, it shows up fine. The console gives the following error: main.js:29 TypeError: r.value.value.trim is not a function

That is referencing the following line of code from PrimeVue's Tooltip component. https://github.com/primefaces/primevue/blob/master/packages/primevue/src/tooltip/Tooltip.js#L25

Any idea what I'm missing here?

<template>
  <div v-tooltip="{ value: local_timestamp }">
    {{ timestamp }}
  </div>
  {{ local_timestamp }}
</template>

<script setup>
import { computed, defineProps } from 'vue'

const props = defineProps({
  timestamp: {
    type: String,
    required: true
  }
})

const local_timestamp = computed(() => {
  return new Date(props.timestamp)
})
</script>

I've been referencing the PrimeVue documentation here: https://primevue.org/tooltip/

2
  • 1
    local_timestamp should return a string, not a Date. Commented Jan 13 at 17:54
  • Can call toString() function as a way to correct. Commented Jan 13 at 18:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.