You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
import classNames from '../common/classNames'
|
|
|
|
Component({
|
|
properties: {
|
|
prefixCls: {
|
|
type: String,
|
|
value: 'wux-skeleton-avatar',
|
|
},
|
|
size: {
|
|
type: String,
|
|
value: 'default',
|
|
},
|
|
shape: {
|
|
type: String,
|
|
value: 'circle',
|
|
},
|
|
},
|
|
data: {
|
|
active: true,
|
|
classes: null
|
|
},
|
|
lifetimes: {
|
|
attached: function () {
|
|
this.setData({
|
|
classes: this.initwrap(this.data.prefixCls, this.data.active, this.data.size, this.data.shape)
|
|
})
|
|
}
|
|
},
|
|
methods: {
|
|
initwrap: function (prefixCls, active, size, shape) {
|
|
const wrap = classNames(prefixCls, {
|
|
[`${prefixCls}--active`]: active,
|
|
[`${prefixCls}--${size}`]: size,
|
|
[`${prefixCls}--${shape}`]: shape,
|
|
})
|
|
return {
|
|
wrap,
|
|
}
|
|
},
|
|
updated(active) {
|
|
if (this.data.active !== active) {
|
|
this.setData({
|
|
active
|
|
})
|
|
}
|
|
},
|
|
},
|
|
})
|