oak-general-business/lib/miniprogram_npm/lin-ui/tabpanel/index.js

81 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// components/tab/index.js
Component({
relations: {
'../tabs/index': {
type: 'parent',
linked: function (target) {
!this.data.parent && this.setData({
parent: target
});
// 每次被插入到custom-ul时执行target是custom-ul节点实例对象触发在attached生命周期之后
}
},
'../combined-tabs/index': {
type: 'parent',
linked: function (target) {
!this.data.parent && this.setData({
parent: target
});
// 每次被插入到custom-ul时执行target是custom-ul节点实例对象触发在attached生命周期之后
}
}
},
/**
* 组件的属性列表
*/
properties: {
tab: String,
subTab: String,
subKey: String,
key: String,
icon: String,
iconSize: {
type: String,
value: '20'
},
image: Object,
picPlacement: {
type: String,
value: 'top'
},
dotBadge: {
type: Boolean,
value: false
},
badgeCount: {
type: Number,
},
badgeMaxCount: {
type: Number,
value: 99
},
badgeCountType: {
type: String,
value: 'overflow'
},
},
observers: {
'**': function (filed) {
this.updateData(filed);
}
},
/**
* 组件的初始数据
*/
data: {
isCurrent: false,
index: 0,
parent: null
},
methods: {
updateData() {
let parent = this.data.parent;
if (!parent) return;
parent.initTabs();
}
}
});