




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第Element樹(shù)形控件整合帶圖標(biāo)的下拉菜單(tree+dropdown+input)目錄需求說(shuō)明:實(shí)現(xiàn)步驟:本文主要講述:自定義樹(shù)形控件el-tree
需求說(shuō)明:
ElementUI官網(wǎng)提供的樹(shù)形控件包含基礎(chǔ)的、可選擇的、自定義節(jié)點(diǎn)內(nèi)容的、帶節(jié)點(diǎn)過(guò)濾的以及可拖拽節(jié)點(diǎn)的樹(shù)形結(jié)構(gòu)如下:
我想要的效果是支持搜索效果的樹(shù),將鼠標(biāo)懸浮后顯示添加修改圖標(biāo),點(diǎn)擊圖標(biāo)后彈出對(duì)應(yīng)頁(yè)面;并且在每個(gè)文件夾前添加自定義圖標(biāo)。
實(shí)現(xiàn)效果:
實(shí)現(xiàn)步驟:
1、使用插槽(slot)
el-col:span="4":xs="24"
!--目錄搜索功能--
div
el-input
v-model="dirNameCn"
placeholder="請(qǐng)輸入目錄名稱"
clearable
size="small"
prefix-icon="el-icon-search"
/div
!--樹(shù)的展示--
div
el-tree
:data="dirTreeOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
@node-click="handleNodeClick"
icon-node-key="id"
:check-on-click-node="true"
!--隱藏的新增等圖標(biāo)--
spanslot-scope="{node,data}"@mouseenter="mouseenter(data)"@mouseleave="mouseleave(data)"
span{{node.label}}/span
div
iv-show="data.show"@click="addDial(node,data)"/
!--隱藏的下拉選--
el-dropdowntrigger="click"placement="right"@command="(command)={handleCommand(command)}"
iv-show="data.show"/
el-dropdown-menuslot="dropdown"
el-dropdown-itemcommand="a"重命名/el-dropdown-item
el-dropdown-itemcommand="b"刪除/el-dropdown-item
/el-dropdown-menu
/el-dropdown
/div
/span
/el-tree
/div
/el-col
2、組件對(duì)應(yīng)的JS
注意:樹(shù)的數(shù)據(jù)是從后端查詢回來(lái)的,保存在dirTreeOptions里面
script
exportdefault{
name:'reqmdoctree',
data(){
return{
//左側(cè)搜索框內(nèi)容
dirNameCn:'',
//目錄樹(shù)選項(xiàng)
dirTreeOptions:undefined,
defaultProps:{
children:"children",
label:"label"
//樹(shù)形菜單中有無(wú)子節(jié)點(diǎn)
yesChild:undefined,
//控制左側(cè)新增提示信息框
show:0,
//查詢需求文檔信息參數(shù)
queryParams:{
docNo:undefined,//文檔編號(hào)
docNameEn:undefined,//文檔英文名稱
dirNo:undefined,//目錄編號(hào)
current:1,//當(dāng)前頁(yè)數(shù)
size:20//每頁(yè)顯示多少條
treeId:undefined,
methods:{
/**查詢需求目錄下拉樹(shù)結(jié)構(gòu)*/
getTreeselect(){
treeselect().then(response={
this.dirTreeOptions=response.data
//搜索值為過(guò)濾函數(shù)
filterNode(value,data){
if(!value)returntrue
returndata.label.indexOf(value)!==-1
//節(jié)點(diǎn)被點(diǎn)擊時(shí)的回調(diào)函數(shù)
handleNodeClick(data){
//console.log(data)
this.treeId=data.id
this.yesChild=data.children
this.queryParams.dirNo=data.id
this.getList()
//樹(shù)中三個(gè)點(diǎn)的事件
handleCommand(command){
if(command=='a'){
selectReqNo(this.treeId).then(response={
this.uuid=response.msg
getObjTree(response.msg).then(response={
this.form=response.data
this.open=true
this.title='修改需求文檔目錄配置表'
if(command=='b'){
if(this.yesChild!=undefined){
this.$notify.error({
title:'警告',
message:'此目錄下還有別的文件夾'
}else{
selectReqNo(this.treeId).then(response={
this.uuid=response.msg
this.$confirm('是否確認(rèn)刪除ID為'+this.uuid+'的數(shù)據(jù)項(xiàng)?','警告',{
confirmButtonText:'確定',
cancelButtonText:'取消',
type:'warning'
}).then(()={
returndelObjTree(this.uuid)
}).then(data={
this.getTreeselect()
this.msgSuccess('刪除成功')
}).catch(function(){
//左側(cè)新建目錄/文件
addDial(node,data){
//console.log(node,'---',data)
this.reset()
this.form.dirParentId=data.id
this.open=true
this.title='添加需求文檔目錄配置表'
//左側(cè)鼠標(biāo)懸浮展示圖標(biāo)
mouseenter(data){
this.
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 藝術(shù)壁材采購(gòu)合同協(xié)議
- 街道貼磚勞動(dòng)合同協(xié)議
- 花籽種子銷售合同協(xié)議
- 航空公司運(yùn)輸合同協(xié)議
- 自愿購(gòu)買房屋合同協(xié)議
- 視頻廣告設(shè)計(jì)合同協(xié)議
- 節(jié)水灌溉項(xiàng)目合同協(xié)議
- 英文合同保密協(xié)議范本
- 衣柜定制工裝合同協(xié)議
- 衣服上定制文字合同協(xié)議
- 西部計(jì)劃面試題目及答案
- 公文筐的測(cè)試題及答案
- 2025靜脈治療規(guī)范
- 航道、通航建筑物及航運(yùn)樞紐大壩運(yùn)行安全風(fēng)險(xiǎn)辨識(shí)評(píng)估管控指南
- 《測(cè)繪生產(chǎn)成本費(fèi)用定額》(2025版)
- 第11課《浪花》課件-2024-2025學(xué)年統(tǒng)編版語(yǔ)文一年級(jí)下冊(cè)
- 《休閑農(nóng)業(yè)》課件 項(xiàng)目六 休閑農(nóng)業(yè)經(jīng)營(yíng)管理
- 教師省骨干考試題及答案
- T-CWEC 40-2023 防汛排澇抗旱一體化泵車
- 廣東省廣州市白云區(qū)2024-2025學(xué)年高三下學(xué)期2月統(tǒng)測(cè)英語(yǔ)試卷(含答案)
- 幼教培訓(xùn)課件:《幼兒園思維共享的組織與實(shí)施》
評(píng)論
0/150
提交評(píng)論