Solution 1 :

The result in convert() is passed as an argument value (not a reference to the component’s data prop). To change the component’s result, use this.result:

export default {
  methods: {
    convert(fromValue, option, result) {
      this.result = /* new value */
    }
  }
}

Solution 2 :

You don’t need to the result value for click event. You have to set the result value of data. Inspite of returning the result you need to set the result as this.result=result

Here is the demo

Problem :

I am having an issue with my Vue app on returning a particular data value from my method to my HTML to be rendered.

The full code can found be here https://github.com/Callum9362/temp-converter/blob/main/src/App.vue

My problem is with line 62. I can return the variable result to the console, but the value is staying at 0 on the page. I am also not getting any errors, which is not helping me solve the problem. Any help would be greatly appreciated.

By