el-dropdown
<el-dropdown trigger="click" @command="handleCommand" >
<span class="el-dropdown-link" style="width: 65px;">
<el-button type="text">{
{
lable }}</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
:command="item"
:key="item"
v-for="item in list"
>{
{
item }}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
---------------------------------------------------------------------------------------------------------
handleCommand(command) {
console.log(command);
this.lable = command;
this.show = true;
},
<span>
<el-dropdown trigger="click" @command="handleDropdown">
<i class="el-icon-plus"></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="folder">
<i class="iconfont icon-yewubao" style="color: #5c8fef"></i
>业务包
</el-dropdown-item>
<el-dropdown-item command="group">
<i
class="iconfont icon-tianjiafenzu"
style="color: #5c8fef"
></i
>分组
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
------------------------------------------------------------------------------------------------------------------
async handleDropdown(command) {
console.log(command);
if (command.data) {
var {
data, command } = command;
if (command == 0) {
this.createFrom.type = 0;
this.createFrom.name = "业务包";
this.createFrom.parentId = data.id;
await create(this.createFrom);
this.getList();
} else {
this.createFrom.type = 1;
this.createFrom.name = "分组";
this.createFrom.parentId = data.id;
await create(this.createFrom);
this.getList();
}
} else {
if (command == "folder") {
this.createFrom.type = 0;
this.createFrom.parentId = 0;
this.createFrom.name = "业务包";
await create(this.createFrom);
this.getList();
} else {
this.createFrom.type = 1;
this.createFrom.parentId = 0;
this.createFrom.name = "分组";
await create(this.createFrom);
this.getList();
}
}
},