第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vuejs2.0 的v-for取消了$index,現(xiàn)在我該如何替換獲取索引額?

vuejs2.0 的v-for取消了$index,現(xiàn)在我該如何替換獲取索引額?

溫溫醬 2018-12-19 18:15:26
問題如題,原來vue1.x可以如下書寫:<el-carousel-item v-for="(item, key, index) in picList" :key="index" >                <el-button id="carouselBtn" type="text" v-on:click="openDownLoad($index)" >                    <img :src="item.img" :alt="item.altstring" class="img-responsive">                </el-button> </el-carousel-item>因為在vue2.x中$index被廢棄了,那如果使用vue2.x,我該如何獲得當(dāng)時的index?直接寫index 點擊后 為 undefined求解?
查看完整描述

1 回答

?
繁星淼淼

TA貢獻(xiàn)1775條經(jīng)驗 獲得超11個贊

<el-carousel-item v-for="(item,index) in picList" >

                <el-button id="carouselBtn" type="text" v-on:click="openDownLoad(index)" >

                    <img :src="item.img" :alt="item.altstring" class="img-responsive">

                </el-button>

 </el-carousel-item>

 

 methods:{

     fun () {

        openDownLoad (index) {

            console.log(index)

        } 

     }

 }


查看完整回答
反對 回復(fù) 2019-01-25
  • 1 回答
  • 0 關(guān)注
  • 405 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號