mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-03 22:59:45 +08:00
parent
13e82ea0db
commit
b7e184aa69
@ -6,7 +6,7 @@ VantComponent({
|
|||||||
relation: {
|
relation: {
|
||||||
name: 'collapse',
|
name: 'collapse',
|
||||||
type: 'ancestor',
|
type: 'ancestor',
|
||||||
current: 'collapse-item'
|
current: 'collapse-item',
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@ -19,22 +19,22 @@ VantComponent({
|
|||||||
clickable: Boolean,
|
clickable: Boolean,
|
||||||
border: {
|
border: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true
|
value: true,
|
||||||
},
|
},
|
||||||
isLink: {
|
isLink: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true
|
value: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
expanded: false
|
expanded: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.animation = wx.createAnimation({
|
this.animation = wx.createAnimation({
|
||||||
duration: 0,
|
duration: 0,
|
||||||
timingFunction: 'ease-in-out'
|
timingFunction: 'ease-in-out',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -79,32 +79,31 @@ VantComponent({
|
|||||||
const { animation } = this;
|
const { animation } = this;
|
||||||
|
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
animation
|
if (height === 0) {
|
||||||
.height(height)
|
animation.height('auto').top(1).step();
|
||||||
.top(1)
|
} else {
|
||||||
.step({
|
animation
|
||||||
duration: inited ? 300 : 1
|
.height(height)
|
||||||
})
|
.top(1)
|
||||||
.height('auto')
|
.step({
|
||||||
.step();
|
duration: inited ? 300 : 1,
|
||||||
|
})
|
||||||
|
.height('auto')
|
||||||
|
.step();
|
||||||
|
}
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
animation: animation.export()
|
animation: animation.export(),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
animation
|
animation.height(height).top(0).step({ duration: 1 }).height(0).step({
|
||||||
.height(height)
|
duration: 300,
|
||||||
.top(0)
|
});
|
||||||
.step({ duration: 1 })
|
|
||||||
.height(0)
|
|
||||||
.step({
|
|
||||||
duration: 300
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
animation: animation.export()
|
animation: animation.export(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -119,6 +118,6 @@ VantComponent({
|
|||||||
const currentName = name == null ? index : name;
|
const currentName = name == null ? index : name;
|
||||||
|
|
||||||
this.parent.switch(currentName, !expanded);
|
this.parent.switch(currentName, !expanded);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user