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

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

Vue數(shù)據(jù)集輸出未定義

Vue數(shù)據(jù)集輸出未定義

守著星空守著你 2021-04-01 18:15:52
我試圖將對象的值和索引傳遞給vue方法。我的方法能夠顯示該值,但索引未定義。請告知我做錯了什么。JAVASCRIPT:<div class="select is-info">    <select @change="change_default_canvas($event.target.value,        $event.target.dataset.index)" id="select_business_model_version">       <option>Select Version</option>       <option v-for="(history,index) in all_business_models_hisotry" :key="index" :value="history.canvas_id" :data-index="index">Date : {{history.date_submitted}}</option>    </select></div>$event.target.dataset.index 正在輸出 undefined
查看完整描述

3 回答

?
撒科打諢

TA貢獻1934條經(jīng)驗 獲得超2個贊

您需要訪問選定的選項元素并從那里獲取數(shù)據(jù)索引。像這樣的東西:

$event.target.options[$event.target.selectedIndex].dataset.index


查看完整回答
反對 回復 2021-04-08
?
眼眸繁星

TA貢獻1873條經(jīng)驗 獲得超9個贊

將您更改@change為以下內(nèi)容:


<select @change="change_default_canvas" id="select_business_model_version">

您的change_default_canvas方法將如下所示:


change_default_canvas(event) {

    console.log(event.target.value)

    console.log(event.target.dataset.index)

    /* your logic here */

}


查看完整回答
反對 回復 2021-04-08
  • 3 回答
  • 0 關(guān)注
  • 272 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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