Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue span value from methods

Tags:

vue.js

I want to get the value from methods and put this value in span element

There is my pseudo code and I don't know what is the right way to do that. Maybe stored in data?

<li v-for="item in items">
  <span>{{I want this value is from methods}} getValue(item)</span>
</li>

methods: {
    getValue: function(value){  
        return "value form methods" + value
    }
}
like image 589
MichaelMao Avatar asked Sep 13 '26 05:09

MichaelMao


1 Answers

Simple like that:

<li v-for="item in items">
  <span>{{ getValue(item) }} </span>
</li>

methods: {
    getValue: function(value){  
        return "value form methods" + value
    }
}

Please do better with your questions quality.

like image 153
Marek Urbanowicz Avatar answered Sep 14 '26 19:09

Marek Urbanowicz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!