Skip to content

Commit

Permalink
fix(swiper): navigation slot (Tencent#2514)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored and methodchen committed Aug 25, 2023
1 parent bc48752 commit 7e0499f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import props from './props';
import { TdSwiperProps, SwiperNavigation, SwiperChangeSource } from './type';
import TSwiperItem from './swiper-item';
import { isVNode } from '../hooks/render-tnode';
import { renderTNodeJSX } from '../utils/render-tnode';
import { emitEvent } from '../utils/event';
import { getClassPrefixMixins, getGlobalIconMixins } from '../config-provider/config-receiver';
import mixins from '../utils/mixins';
Expand Down Expand Up @@ -264,7 +265,10 @@ export default mixins(Vue as VueConstructor<SwiperVue>, classPrefixMixins, getGl
);
},
renderNavigation() {
const navigationSlot = renderTNodeJSX(this, 'navigation');
if (isVNode(this.navigation as VNode)) return this.navigation;
if (navigationSlot && isVNode(navigationSlot?.[0])) return navigationSlot;

if (this.navigationConfig.type === 'fraction') {
return (
<div class={[`${this.componentName}__navigation`, `${this.componentName}__navigation--fraction`]}>
Expand Down

0 comments on commit 7e0499f

Please sign in to comment.