Skip to content

Commit

Permalink
fix(taro-components): 修复swiper样式, fix #6159
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed May 2, 2020
1 parent c81a1d5 commit a037649
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 66 deletions.
10 changes: 7 additions & 3 deletions packages/taro-components/src/components/swiper/style/index.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
taro-swiper-core {
display: block;
height: 150px;
}
.swiper-container {
height: 150px;
height: 100%;
}
.swiper-pagination {
font-size: 0;
font-size: 0;
}
.swiper-pagination-bullet {
opacity: 1
opacity: 1
}
51 changes: 0 additions & 51 deletions packages/taro-components/src/components/swiper/style/swiper.scss

This file was deleted.

26 changes: 14 additions & 12 deletions packages/taro-components/src/components/swiper/swiper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, ComponentInterface, Prop, Event, EventEmitter, Watch } from '@stencil/core'
import { Component, h, ComponentInterface, Prop, Event, EventEmitter, Watch, Host } from '@stencil/core'
import Swipers from 'swiper'
import classNames from 'classnames'

Expand Down Expand Up @@ -197,18 +197,20 @@ export class Swiper implements ComponentInterface {
}

return (
<div class={cls} style={style}>
<style type='text/css'>
{`
.taro-swiper-${this._id} .swiper-pagination-bullet { background: ${indicatorColor} }
.taro-swiper-${this._id} .swiper-pagination-bullet-active { background: ${indicatorActiveColor} }
`}
</style>
<div class='swiper-wrapper'>
<slot />
<Host>
<div class={cls} style={style}>
<style type='text/css'>
{`
.taro-swiper-${this._id} .swiper-pagination-bullet { background: ${indicatorColor} }
.taro-swiper-${this._id} .swiper-pagination-bullet-active { background: ${indicatorActiveColor} }
`}
</style>
<div class='swiper-wrapper'>
<slot />
</div>
<div class={paginationCls} />
</div>
<div class={paginationCls} />
</div>
</Host>
)
}
}

0 comments on commit a037649

Please sign in to comment.