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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

vue遍歷時(shí)如何根據(jù)索引給el-button的Type賦值,為什么我讓Type等于一個(gè)函數(shù)不可以呢,

vue遍歷時(shí)如何根據(jù)索引給el-button的Type賦值,為什么我讓Type等于一個(gè)函數(shù)不可以呢,

溫溫醬 2019-03-07 14:15:48
<el-button :key="tag.id" v-for="(tag,index) in tags" type="buttonType(index)" v-if="tag.state==0">{{tag.name}}</el-button>methods:        {            onSubmit() {                console.log('submit!');            },            buttonType(index){                console.log(index)                if(index%5==4){                    return "primary";                }else if(index%5==3){                    return "success";                }else if(index%5==2){                    return "info";                }else if(index%5==1){                    return "warning";                }else if(index%5==0){                    return "danger";                }            }        }                我是這么寫的,但是無法執(zhí)行,應(yīng)該怎么寫最簡(jiǎn)便,最簡(jiǎn)潔
查看完整描述

2 回答

?
人到中年有點(diǎn)甜

TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超7個(gè)贊

試試 :type="buttonType(index)" 這么寫可不可以


查看完整回答
1 反對(duì) 回復(fù) 2019-03-18
?
森林海

TA貢獻(xiàn)2011條經(jīng)驗(yàn) 獲得超2個(gè)贊

因?yàn)槟鉻ype屬性的值是動(dòng)態(tài)的,所以用v-bind:type 簡(jiǎn)寫為:type


查看完整回答
反對(duì) 回復(fù) 2019-03-18
  • 2 回答
  • 0 關(guān)注
  • 4408 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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