Bouffe
Bouffe

Reputation: 849

vue.js - conditions and custom filter

I'm trying to use 3 conditions to display several texts to a tooltip with bootstrap.

 <span class="icon icon-info"
  data-toggle="tooltip-click"
  data-placement="right"
  data-trigger="focus hover"
  v-bind:data-original-title="
    condition1 ?
        condition2 ?
           'some.key.id' | customFilter : 'some.key.id2' | customFilter
    :
        condition3 ?
            'some.key.id3' | customFilter : 'some.key.id4' | customFilter
   "
  data-html="true">
</span>

And it throw this exception

enter image description here

What did I do wrong?

Edit:

I'm working on VueJs 1, and my customFilter is working well individually

<span class="icon icon-info"
  data-toggle="tooltip-click"
  data-placement="right"
  data-trigger="focus hover"
  v-bind:data-original-title="'some.key.id' | customFilter"
  data-html="true">
</span>

Upvotes: 0

Views: 2090

Answers (1)

GuyC
GuyC

Reputation: 6574

I'm not sure if you are using Vue 2 but if you are then it has moved away from using custom filters, check out:

https://v2.vuejs.org/v2/guide/migration.html#Filters

What you posted looks messy. I would recommend moving this logic into a computed property.

Upvotes: 1

Related Questions