How to call Adonis hook function in Vue JS?


#1

Hi,

Usually you just call adonis hook function by :

{{ formatPrice(x.amount) }}

But now, I am using Vue in edge, how to call this?

@{{ formatPrice(x.amount) }}

will call the Vue function inside method, not Adonis hook anymore

Thanks! Hope my question is understandable


#2

I believe you are talking about the global functions. Nope, you cannot write functions in Edge and run them inside Vue and neither it makes any sense. Simply create methods in Vue instead


#3

Yes, global functions.
I see, I just don’t want to repeat doing the same things in Vue methods section

Thanks btw @virk :+1:


#4

Yeah, but code sharing is not possible and neither it’s as simple as it sounds.

Also if you are using Vue, you should keep all of your views inside it and simply don’t use Edge, mixing them again is not a nice idea


#5

Yeah, I mainly use Edge. The Vue JS is only like cherry on top (like jQuery addition)


#6

You can use Vue.js filters but as @virk stated. You should write your logic in the frontend again.

https://vuejs.org/v2/guide/filters.html