I have an app to set a filter depending on desktop or mobile design, but the ternary operator doesn't work.
Here is the component call:
<Metric
prefix="R$"
:is-numeric-subvalue="false"
:is-total="true"
subvalue="Abril à Maio"
title="Disponível"
:value="highlightData.available | defineFilter()"
/>
Here is my method to define the filter:
methods: {
defineFilter () {
const test = true
const filter = test ? this.$options.filters.decimal(0) : this.$options.filters.shortedNumber()
return filter
}
}
My filters:
filters: {
decimal: decimalFilter,
shortedNumber: shortedNumberFilter
}
I received the warning:
[Vue warn]: Failed to resolve filter: defineFilter