操屁眼的视频在线免费看,日本在线综合一区二区,久久在线观看免费视频,欧美日韩精品久久综

新聞資訊

    原理:沒什么原理就是無限遞歸,組件引用組件本身小程序無限列表小程序無限列表,如果在有子級的情況下才引用。

    * 此處對遞歸原理不是很熟悉的需要注意一個坑,就是在對組件展開和關閉時候。只需要拿到當前坐標對數組對象直接賦值,并不需要去獲取所謂的多維坐標數組。不管你的對象在總數組的第幾層,他永遠在當前數組的第一層

    1.1、tree組件:wxml

    
    	
    		
    			
    			
    			{{item.title}}
    		
    		
    			
    		
    	
    
    

    1.2、tree組件:wxss

    .red{
    	border: 1px red solid;
    }
    .view_{
    	padding: 16rpx 0;
    }
    .view_:last-child{
    	padding: 0;
    }
    .left40{
    	margin-left: 40rpx;
    }

    1.3、tree組件:js

    Component({
    	properties: {
    		treeArr: {
    			type: Array,
    			value: []
    		},
    	},
    	methods: {
    		treeClick(e) {
    			this.setData({
    				['treeArr[' + e.currentTarget.dataset.index + '].open']: !e.currentTarget.dataset.item
    					.open
    			})
    		},
    	}
    })

    1.4、tree組件:json

    {
    	"component": true,
    	"usingComponents": {
    	}
    }

    2、直接在app.json全局引入注冊組件

    	"usingComponents": {
    		"z-tree": "/components/tree/tree"
    	}

    3.1、父組件調用wxml

    
    	
    

    3.2、父組件js

    Page({
    	data: {
    		listData: [{
    				title: '1',
    				open: false,
    				children: [{
    						title: '1-1',
    						open: false,
    						children: [],
    					},
    					{
    						title: "1-2",
    						open: false,
    						children: [{
    							title: '1-2-1',
    							open: false,
    							children: []
    						}, ]
    					}
    				]
    			},
    			{
    				title: '2',
    				children: [],
    				open: false,
    			}
    		],
    	},
    })
    

    為了讓代碼變得最簡單,所以沒加什么圖標與樣式

網站首頁   |    關于我們   |    公司新聞   |    產品方案   |    用戶案例   |    售后服務   |    合作伙伴   |    人才招聘   |   

友情鏈接: 餐飲加盟

地址:北京市海淀區    電話:010-     郵箱:@126.com

備案號:冀ICP備2024067069號-3 北京科技有限公司版權所有