vue+iview使用樹(shù)形控件的具體使用
vue+iview使用樹(shù)形控件
1.開(kāi)發(fā)環(huán)境 vue+iview
2.電腦系統(tǒng) windows10專(zhuān)業(yè)版
3.在使用 vue+iview開(kāi)發(fā)的過(guò)程中,我們經(jīng)常會(huì)使用 iview的樹(shù)形控件,在這里我就簡(jiǎn)單的做一個(gè)分享,希望對(duì)你有所幫助!
4.在template中添加如下代碼:
<Scroll style="width: 100%" height="760">
<Tree
@on-select-change="chentreelick"
:data="treedata"
expand-node
></Tree>
</Scroll>
5.在 return 中添加如下代碼:
treedata: [
{
title: "parent 1",
chenshow: false,
expand: true,
children: [
{
title: "parent 1-1",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-1-1",
chenshow: true,
},
{
title: "leaf 1-1-2",
chenshow: true,
selected: true,
},
],
},
{
title: "parent 1-2",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-2-1",
chenshow: true,
},
{
title: "leaf 1-2-1",
chenshow: true,
},
],
},
{
title: "parent 1-3",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-3-1",
chenshow: true,
},
{
title: "leaf 1-3-1",
chenshow: true,
},
],
},
{
title: "parent 1-4",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-4-1",
chenshow: true,
},
{
title: "leaf 1-4-1",
chenshow: true,
},
],
},
{
title: "parent 1-5",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-5-1",
chenshow: true,
},
{
title: "leaf 1-5-1",
chenshow: true,
},
],
},
{
title: "parent 1-6",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-6-1",
chenshow: true,
},
{
title: "leaf 1-6-1",
chenshow: true,
},
],
},
{
title: "parent 1-7",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-7-1",
chenshow: true,
},
{
title: "leaf 1-7-1",
chenshow: true,
},
],
},
{
title: "parent 1-8",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-8-1",
chenshow: true,
},
{
title: "leaf 1-8-1",
chenshow: true,
},
],
},
{
title: "parent 1-9",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-9-1",
chenshow: true,
},
{
title: "leaf 1-9-1",
chenshow: true,
},
],
},
],
},
],
5-1.注意 這個(gè) return中綁定的數(shù)據(jù),可以參考 iview官方文檔,地址如下:
https://www.iviewui.com/components/tree
6.在 methods中添加如下代碼:
chentreelick(data) {
console.log(data);
console.log("點(diǎn)擊了");
console.log(data[0].chenshow);
},
//注意:參數(shù) data,在點(diǎn)擊的時(shí)候可以獲取到后臺(tái)的數(shù)據(jù),這個(gè)數(shù)據(jù)是來(lái)自后臺(tái)的,在實(shí)際開(kāi)發(fā)中,我們可以 利用 data,把后臺(tái)需要的id傳給 后臺(tái)
到此這篇關(guān)于vue+iview使用樹(shù)形控件的具體使用的文章就介紹到這了,更多相關(guān)vue iview 樹(shù)形控件內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- 不依任何賴(lài)第三方,單純用vue實(shí)現(xiàn)Tree 樹(shù)形控件的案例
- Vue+Element UI 樹(shù)形控件整合下拉功能菜單(tree + dropdown +input)
- 詳解vue-element Tree樹(shù)形控件填坑路
- vue elementUI tree樹(shù)形控件獲取父節(jié)點(diǎn)ID的實(shí)例
- vue.js element-ui tree樹(shù)形控件改iview的方法
- VUE餓了么樹(shù)形控件添加增刪改功能的示例代碼
- 解決ant design vue中樹(shù)形控件defaultExpandAll設(shè)置無(wú)效的問(wèn)題
- vue遞歸組件實(shí)戰(zhàn)之簡(jiǎn)單樹(shù)形控件實(shí)例代碼
- vue用遞歸組件寫(xiě)樹(shù)形控件的實(shí)例代碼
- vue樹(shù)形控件tree的使用方法
相關(guān)文章
vue實(shí)現(xiàn)自定義el-table穿梭框功能
這篇文章主要介紹了vue實(shí)現(xiàn)自定義el-table穿梭框功能,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-02-02
vue實(shí)現(xiàn)鍵盤(pán)輸入支付密碼功能
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)鍵盤(pán)輸入支付密碼功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-08-08
使用Webpack提升Vue.js應(yīng)用程序的4種方法(翻譯)
這篇文章主要介紹了使用Webpack提升Vue.js應(yīng)用程序的4種方法(翻譯),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10
vue-cli點(diǎn)擊實(shí)現(xiàn)全屏功能
這篇文章主要為大家詳細(xì)介紹了vue-cli點(diǎn)擊實(shí)現(xiàn)全屏功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-03-03
基于vue.js輪播組件vue-awesome-swiper實(shí)現(xiàn)輪播圖
一般做移動(dòng)端輪播圖的時(shí)候,最常用的就是Swiper插件了,而vue.js也有一個(gè)輪播組件vue-awesome-swiper,用法跟swiper相似。接下來(lái)通過(guò)本文給大家詳解講解vue.js輪播組件vue-awesome-swiper實(shí)現(xiàn)輪播圖實(shí)例代碼,需要的朋友參考下2017-03-03
vue3實(shí)現(xiàn)封裝時(shí)間計(jì)算-日期倒計(jì)時(shí)組件-還有XX天&第XX天
這篇文章主要介紹了vue3實(shí)現(xiàn)封裝時(shí)間計(jì)算-日期倒計(jì)時(shí)組件-還有XX天&第XX天,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03
vue使用openlayers實(shí)現(xiàn)移動(dòng)點(diǎn)動(dòng)畫(huà)
這篇文章主要為大家詳細(xì)介紹了vue使用openlayers實(shí)現(xiàn)移動(dòng)點(diǎn)動(dòng)畫(huà),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-09-09
uniapp項(xiàng)目國(guó)際化標(biāo)準(zhǔn)的配置與實(shí)現(xiàn)
UniApp是一種基于Vue.js的跨平臺(tái)開(kāi)發(fā)框架,可以快速地開(kāi)發(fā)同時(shí)運(yùn)行在多個(gè)平臺(tái)的應(yīng)用程序,這篇文章主要介紹了uniapp項(xiàng)目國(guó)際化標(biāo)準(zhǔn)的配置與實(shí)現(xiàn),需要的朋友可以參考下2023-11-11

