elementUI使用中遇见的问题之Dropdown 下拉菜单

543 阅读1分钟

下拉事件绑定,@click 无法触发和获取参数

不采用原生指令事件,是因为要获取for循环中item,index;

<el-dropdown class="button">  
    <span class="el-dropdown-link">     操作按钮   </span> 
    <el-dropdown-menu slot="dropdown">  
    <el-dropdown-item @click.native="view(o,index)"><div><i class="el-icon-view"></i>预览</div></el-dropdown-item>    
    <el-dropdown-item @click.native="addImage(o,index)"><i class="el-icon-circle-plus"></i>新增</el-dropdown-item>     
    <el-dropdown-item @click.native="updateImage(o,index)"><i class="el-icon-refresh"></i>更新</el-dropdown-item>    
    <el-dropdown-item @click.native="deleteImg(o,index)"> <i class="el-icon-delete-solid"></i>删除</el-dropdown-item>   
    </el-dropdown-menu>
</el-dropdown>

下拉框互斥事件

<fu-select v-model="scope.row[item.prop]" placeholder="请选择"   filterable clearable @focus="mutex">  
        <fu-option                    
        v-for="item in options[item.prop]"                      
        :key="item.value"                      
        :label="item.text"                       
        :disabled="item.text !== scope.row[item.prop] && dsColumnName.includes(item.text)"                       
        :value="item.value">                    
        </fu-option> 
</fu-select>

mutex(e){       
let now  = e.target.value;     
//表格数据判断 除当前数据外其他被西选中的值      
//符合条件的值 disabled = true     
this.dsColumnName.splice(0)       
this.dialogTable.data.rows.forEach((ele)=>{      
let name = ele.dsColumnName;         
if(name){        
this.dsColumnName.push(name)   
}     
})   
},