亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - I get an error when I bind an event in v-for in vue?
過去多啦不再A夢
過去多啦不再A夢 2017-05-19 10:38:42
0
2
815

I looped to generate route-link in v-for and wanted to bind an event to it. However, an error was reported saying that the event was undefined. The following is my code

    <ul class="card-list">
      <li v-for="(url, index) in urls">
        <router-link class="linkTo" :to="'/Page' + (index + 1)">
          <img @click="total(index)" class="cardWidth" :src="url" alt="">
        </router-link>
      </li>
    </ul>
    
    method: {
      total: function (index) {
        console.log(index)
      }
    }
    
    

Error message:

Property or method "total" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. 
Uncaught TypeError: _vm.total is not a function
過去多啦不再A夢
過去多啦不再A夢

reply all(2)
PHPzhong

is methods

http://vuejs.org/v2/api/#methods

我想大聲告訴你

The total method is not defined, the downstairs is correct

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template