赞
踩
<el-tree ref="sceneTreeRef" :filter-node-method="filterNode" class="scene-layer-tree" show-checkbox node-key="nodeKey" :allow-drag="allowDragHandler" :allow-drop="allowDropHandler" @node-drop="handleDrop" :data="TreeData.list" draggable default-expand-all @check="check"> <template #default="{ data }"> <span :title="data.title" class="tree-item-title"> <i class="fal fa-folder-open" style="color: #f2cc7b; margin: 5px" v-if="data.type == 'group'"></i> <!-- 可以选择用一个< span >将整个< el-popover >包起来,给span加 一个 @click.stop,即可阻止冒泡 --> <span @click.stop> <el-popover placement="top" :width="200" trigger="click" class="propovers"> <template #reference> <i class="fal fa-cog icon-setting"></i> </template> <template #default> <div class="edit-item" v-if="data.type != 'root'" @click=editLayer(data)> <i class="fal fa-edit"></i> <span>{{ $t("x_edit") }}</span> </div> <div class="edit-item" v-if="data.type == 'group' || data.type == 'root'" @click="addNewLayer(data)"> <i class="fal fa-layer-plus"></i> <span>{{ $t("x_add_a_new_layer") }}</span> </div> <div class="edit-item" v-if="data.type == 'group' || data.type == 'root'" @click="addFolder(data)"> <i class="fal fa-folder-plus"></i> <span>{{ $t("x_add_folders") }}</span> </div> <div class="edit-item" v-if="data.type != 'root'" @click="deleteLayerFromTree(data)"> <i class="fal fa-trash-alt"></i> <span>{{ $t("x_delete") }}</span> </div> </template> </el-popover> </span> {{ data.title }} </span> </template> </el-tree>
解决方法: 可以选择用一个< span >将整个< el-popover >包起来,给span加 一个 @click.stop,即可阻止冒泡
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。