R
R
reasonov2021-03-27 09:29:19
Vue.js
reasonov, 2021-03-27 09:29:19

v-bind:src not working?

Hello, there was such a problem, there is img :bind="func()", in the function if, else check, in each return that displays the desired value, when the page is loaded, the value from the if is set, then else works (checked through the console), but the value in :src doesn't change, why?
img: Function:
<img :src="onValue()">

onValue(val) {
      if(val === undefined) {
        console.log('aaa',val)
        return require('@/assets/img/lazer1.gif');
      }
      else if(val >= 0){
        console.log(val) //выводит val (1,2,3,4,5)
        return require('@/assets/img/lazer'+ val +'.gif'); //это значение не возращается
      }
    }

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question