mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: migrate Swipe component
This commit is contained in:
parent
79511fe331
commit
f978642277
@ -62,4 +62,6 @@ module.exports = [
|
|||||||
'notify',
|
'notify',
|
||||||
'collapse',
|
'collapse',
|
||||||
'collapse-item',
|
'collapse-item',
|
||||||
|
'swipe',
|
||||||
|
'swipe-item',
|
||||||
];
|
];
|
||||||
|
@ -56,8 +56,8 @@ export default createComponent({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class={bem()} style={this.style} {...{ on: this.$listeners }}>
|
<div class={bem()} style={this.style}>
|
||||||
{this.shouldRender && this.slots()}
|
{this.shouldRender ? this.$slots.default?.() : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
<demo-block :title="t('title2')">
|
<demo-block :title="t('title2')">
|
||||||
<van-swipe :autoplay="3000">
|
<van-swipe :autoplay="3000">
|
||||||
<van-swipe-item v-for="(image, index) in images" :key="index">
|
<van-swipe-item v-for="(image, index) in images" :key="index">
|
||||||
<img v-lazy="image" />
|
<img :src="image" />
|
||||||
|
<!-- TODO -->
|
||||||
|
<!-- <img v-lazy="image" /> -->
|
||||||
</van-swipe-item>
|
</van-swipe-item>
|
||||||
</van-swipe>
|
</van-swipe>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
@ -62,6 +62,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['change'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
rect: null,
|
rect: null,
|
||||||
@ -385,10 +387,9 @@ export default createComponent({
|
|||||||
|
|
||||||
genIndicator() {
|
genIndicator() {
|
||||||
const { count, activeIndicator } = this;
|
const { count, activeIndicator } = this;
|
||||||
const slot = this.slots('indicator');
|
|
||||||
|
|
||||||
if (slot) {
|
if (this.$slots.indicator) {
|
||||||
return slot;
|
return this.$slots.indicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.showIndicators && count > 1) {
|
if (this.showIndicators && count > 1) {
|
||||||
@ -414,7 +415,7 @@ export default createComponent({
|
|||||||
style={this.trackStyle}
|
style={this.trackStyle}
|
||||||
class={bem('track', { vertical: this.vertical })}
|
class={bem('track', { vertical: this.vertical })}
|
||||||
>
|
>
|
||||||
{this.slots()}
|
{this.$slots.default?.()}
|
||||||
</div>
|
</div>
|
||||||
{this.genIndicator()}
|
{this.genIndicator()}
|
||||||
</div>
|
</div>
|
||||||
|
@ -273,10 +273,10 @@ module.exports = {
|
|||||||
path: 'sticky',
|
path: 'sticky',
|
||||||
title: 'Sticky 粘性布局',
|
title: 'Sticky 粘性布局',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'swipe',
|
path: 'swipe',
|
||||||
// title: 'Swipe 轮播',
|
title: 'Swipe 轮播',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'tag',
|
path: 'tag',
|
||||||
title: 'Tag 标记',
|
title: 'Tag 标记',
|
||||||
@ -607,10 +607,10 @@ module.exports = {
|
|||||||
path: 'sticky',
|
path: 'sticky',
|
||||||
title: 'Sticky',
|
title: 'Sticky',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'swipe',
|
path: 'swipe',
|
||||||
// title: 'Swipe',
|
title: 'Swipe',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'tag',
|
path: 'tag',
|
||||||
title: 'Tag',
|
title: 'Tag',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user