vant
This commit is contained in:
1
utils/dist/tab/index.d.ts
vendored
Normal file
1
utils/dist/tab/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
56
utils/dist/tab/index.js
vendored
Normal file
56
utils/dist/tab/index.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
relation: {
|
||||
name: 'tabs',
|
||||
type: 'ancestor',
|
||||
linked(target) {
|
||||
this.parent = target;
|
||||
},
|
||||
unlinked() {
|
||||
this.parent = null;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
title: String,
|
||||
disabled: Boolean,
|
||||
titleStyle: String,
|
||||
name: {
|
||||
type: [Number, String],
|
||||
value: '',
|
||||
}
|
||||
},
|
||||
data: {
|
||||
active: false
|
||||
},
|
||||
watch: {
|
||||
title: 'update',
|
||||
disabled: 'update',
|
||||
dot: 'update',
|
||||
info: 'update',
|
||||
titleStyle: 'update'
|
||||
},
|
||||
methods: {
|
||||
getComputedName() {
|
||||
if (this.data.name !== '') {
|
||||
return this.data.name;
|
||||
}
|
||||
return this.index;
|
||||
},
|
||||
updateRender(active, parent) {
|
||||
const { data: parentData } = parent;
|
||||
this.inited = this.inited || active;
|
||||
this.setData({
|
||||
active,
|
||||
shouldRender: this.inited || !parentData.lazyRender,
|
||||
shouldShow: active || parentData.animated
|
||||
});
|
||||
},
|
||||
update() {
|
||||
if (this.parent) {
|
||||
this.parent.updateTabs();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
3
utils/dist/tab/index.json
vendored
Normal file
3
utils/dist/tab/index.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
8
utils/dist/tab/index.wxml
vendored
Normal file
8
utils/dist/tab/index.wxml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ utils.bem('tab__pane', { active, inactive: !active }) }}"
|
||||
style="{{ shouldShow ? '' : 'display: none;' }}"
|
||||
>
|
||||
<slot wx:if="{{ shouldRender }}" />
|
||||
</view>
|
||||
1
utils/dist/tab/index.wxss
vendored
Normal file
1
utils/dist/tab/index.wxss
vendored
Normal file
@@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';:host{-webkit-flex-shrink:0;flex-shrink:0;width:100%}.van-tab__pane,:host{box-sizing:border-box}.van-tab__pane{overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
|
||||
Reference in New Issue
Block a user