vue動(dòng)態(tài)循環(huán)出的多個(gè)select出現(xiàn)過的變?yōu)閐isabled(實(shí)例代碼)
vue動(dòng)態(tài)循環(huán)出的多個(gè)select出現(xiàn)過的變?yōu)閐isabled
<template>
<div class="artcle">
<el-form
label-width="100px"
:model="testForm">
<el-form-item
v-for="(vtem, index) in testForm.version"
:key="index"
label="命令版本">
<el-select
@change="comChange"
v-model="vtem.ver">
<el-option
v-for="item in versionList"
:key="item.id"
:value="item.id"
:disabled="item.id == vtem.ver || selectedArr.includes(item.id)"
:label="item.name">
</el-option>
</el-select>
<el-button
icon="el-icon-circle-plus-outline"
size="small"
@click="add(index)"
circle></el-button>
<el-button
icon="el-icon-remove-outline"
size="small"
@click="remove(index)"
:disabled="index === 0"
circle></el-button>
</el-form-item>
<el-form-item
label="測試輸入框">
<el-input
v-model="testForm.input"></el-input>
</el-form-item>
</el-form>
</div>
</template>
ps:vue 動(dòng)態(tài)循環(huán)出的多個(gè)select 不能重復(fù)選擇相同的數(shù)據(jù)
<template>
<div class="program" v-for="(parItem,index) in parArr" :key="parItem.guid">
<Select v-model="parItem.id" @on-change="onChangeProgram">
<Option v-for="(subItem,idx) in programList" :key="subItem.id" :data-index='idx'
v-show="parItem.id == subItem.id || !selectIdsArr.includes(subItem.id)"
:value="subItem.id> {{subItem.name}}</Option>
</Select>
</div>
</template>
<script>
export default {
data() {
return {
parArr:[],
selectIdsArr:[],
programList:[{
"id":1,
"name":"選項(xiàng)1"
},{
"id":2,
"name":"選項(xiàng)2"
},{
"id":3,
"name":"選項(xiàng)3"
}],
}
},
methods: {
onChangeProgram() {
this.selectIdsArr = [];
for (const item of this.parArr) {
if (item.id) {
this.selectIdsArr.push(item.id);
}
}
},
},
}
</script>
總結(jié)
以上是小編給大家分享的vue動(dòng)態(tài)循環(huán)出的多個(gè)select出現(xiàn)過的變?yōu)閐isabled效果,希望對大家有所幫助!
相關(guān)文章
Vue實(shí)現(xiàn)輸入框回車發(fā)送和粘貼文本與圖片功能
這篇文章主要為大家詳細(xì)介紹了Vue如何實(shí)現(xiàn)聊天輸入框回車發(fā)送、粘貼文本(包括HTML)、粘貼圖片等功能,文中的實(shí)現(xiàn)方法講解詳細(xì),需要的可以參考一下2022-05-05
Vue 項(xiàng)目中如何使用fullcalendar 時(shí)間段選擇插件(類似課程表格)
最近完成一個(gè)項(xiàng)目,需要選擇一個(gè)會(huì)議室,但是最好能夠通過在圖上顯示出該 會(huì)議室在某某時(shí)間段內(nèi)已經(jīng)被預(yù)定了,初看這個(gè)功能感覺很棘手,仔細(xì)分析下實(shí)現(xiàn)起來還是挺容易的,下面通過示例代碼講解Vue項(xiàng)目中使用fullcalendar時(shí)間段選擇插件,感興趣的朋友一起看看吧2024-07-07
利用Vue Native構(gòu)建移動(dòng)應(yīng)用的全過程記錄
VueNative是一個(gè)使用JavaScript構(gòu)建跨平臺(tái)原生移動(dòng)應(yīng)用程序的框架m這篇文章主要給大家介紹了關(guān)于如何利用Vue Native構(gòu)建移動(dòng)應(yīng)用的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2021-08-08
el-table-column 內(nèi)容不自動(dòng)換行的解決方法
本文主要介紹了el-table-column 內(nèi)容不自動(dòng)換行的解決方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-08-08
vue-cli項(xiàng)目代理proxyTable配置exclude的方法
今天小編就為大家分享一篇vue-cli項(xiàng)目代理proxyTable配置exclude的方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-09-09

