Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
fix: Avatar LoadMore Button
Browse files Browse the repository at this point in the history
  • Loading branch information
pengshanglong committed May 13, 2020
1 parent f67b50e commit b902321
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
24 changes: 11 additions & 13 deletions src/components/avatar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
},
openData: {
type: Object,
default: () => {},
default: () => ({}),
},
customStyle: {
type: [Object, String],
Expand All @@ -40,7 +40,7 @@ export default {
},
},

render() {
render(h) {
const { size, circle, image, text, openData, customStyle, className } = this
const rootClassName = ['at-avatar']
const iconSize = SIZE_CLASS[size || 'normal']
Expand All @@ -52,19 +52,17 @@ export default {
let letter = ''
if (text) letter = text[0]

let elem
if (openData && openData.type === 'userAvatarUrl' && this.$isWEAPP()) {
// TODO OpenData Component
elem = <OpenData type={openData.type}></OpenData>
} else if (image) {
elem = <image class="at-avatar__img" src={image} />
} else {
elem = <text class="at-avatar__text">{letter}</text>
}

const isOpenData = openData && openData.type === 'userAvatarUrl' && this.$isWEAPP()
const isImage = !isOpenData && image !== ''
const isText = !isOpenData && !image
console.log('isOpenData', isOpenData)
console.log('isImage', isImage)
console.log('isText', isText)
return (
<view class={classNames(rootClassName, classObject, className)} style={customStyle}>
{elem}
{isOpenData && <OpenData type={openData.type}></OpenData>}
{isImage && <image class="at-avatar__img" src={image} />}
{isText && <view class="at-avatar__text">{letter}</view>}
</view>
)
},
Expand Down
7 changes: 0 additions & 7 deletions src/components/button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,7 @@ export default {
const loadingColor = type === 'primary' ? '#fff' : ''
const loadingSize = size === 'small' ? '30' : 0

let loadingComponent = null
if (loading) {
loadingComponent = (
<view className="at-button__icon">
<Loading color={loadingColor} size={loadingSize} />
</view>
)
rootClassName.push('at-button--icon')
}

Expand Down Expand Up @@ -248,7 +242,6 @@ export default {
<Loading color={loadingColor} size={loadingSize} />
</view>
)}
{loadingComponent}
<view class="at-button__text">{this.$slots.default}</view>
</view>
)
Expand Down
5 changes: 3 additions & 2 deletions src/components/load-more/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames'
import Button from '../button/index'
import AtActivityIndicator from '../activity-indicator/index'

export default {
Expand Down Expand Up @@ -61,9 +62,9 @@ export default {
} else if (status === 'more') {
component = (
<view class="at-load-more__cnt">
<AtButton full onClick={this.onClick} customStyle={moreBtnStyle}>
<Button full onTap={this.onClick} customStyle={moreBtnStyle}>
{moreText}
</AtButton>
</Button>
</view>
)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
color="#F00"
/>
</Badge>
<Button
<!-- <Button
loading
type="primary"
:on-click="onClick"
>
hello
</Button>
</Button> -->
<Fab>fab</Fab>
<Avatar text="111" />
<Curtain
Expand Down

0 comments on commit b902321

Please # to comment.