diff --git a/components.js b/components.js
index ef067b29d..ae9960b70 100644
--- a/components.js
+++ b/components.js
@@ -62,4 +62,6 @@ module.exports = [
'notify',
'collapse',
'collapse-item',
+ 'swipe',
+ 'swipe-item',
];
diff --git a/src/swipe-item/index.js b/src/swipe-item/index.js
index 6e01fed0e..a1c1ca0a6 100644
--- a/src/swipe-item/index.js
+++ b/src/swipe-item/index.js
@@ -56,8 +56,8 @@ export default createComponent({
render() {
return (
-
- {this.shouldRender && this.slots()}
+
+ {this.shouldRender ? this.$slots.default?.() : null}
);
},
diff --git a/src/swipe/demo/index.vue b/src/swipe/demo/index.vue
index 5833b0de6..a39c21dbd 100644
--- a/src/swipe/demo/index.vue
+++ b/src/swipe/demo/index.vue
@@ -12,7 +12,9 @@
-
+
+
+
diff --git a/src/swipe/index.js b/src/swipe/index.js
index 608289690..a12da6827 100644
--- a/src/swipe/index.js
+++ b/src/swipe/index.js
@@ -62,6 +62,8 @@ export default createComponent({
},
},
+ emits: ['change'],
+
data() {
return {
rect: null,
@@ -385,10 +387,9 @@ export default createComponent({
genIndicator() {
const { count, activeIndicator } = this;
- const slot = this.slots('indicator');
- if (slot) {
- return slot;
+ if (this.$slots.indicator) {
+ return this.$slots.indicator();
}
if (this.showIndicators && count > 1) {
@@ -414,7 +415,7 @@ export default createComponent({
style={this.trackStyle}
class={bem('track', { vertical: this.vertical })}
>
- {this.slots()}
+ {this.$slots.default?.()}
{this.genIndicator()}
diff --git a/vant.config.js b/vant.config.js
index 007aad611..5e7cc0fc1 100644
--- a/vant.config.js
+++ b/vant.config.js
@@ -273,10 +273,10 @@ module.exports = {
path: 'sticky',
title: 'Sticky 粘性布局',
},
- // {
- // path: 'swipe',
- // title: 'Swipe 轮播',
- // },
+ {
+ path: 'swipe',
+ title: 'Swipe 轮播',
+ },
{
path: 'tag',
title: 'Tag 标记',
@@ -607,10 +607,10 @@ module.exports = {
path: 'sticky',
title: 'Sticky',
},
- // {
- // path: 'swipe',
- // title: 'Swipe',
- // },
+ {
+ path: 'swipe',
+ title: 'Swipe',
+ },
{
path: 'tag',
title: 'Tag',