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.
59 lines
1.4 KiB
59 lines
1.4 KiB
import baseComponent from '../helpers/baseComponent'
|
|
import classNames from '../helpers/classNames'
|
|
|
|
baseComponent({
|
|
relations: {
|
|
'../skeleton/index': {
|
|
type: 'ancestor',
|
|
},
|
|
},
|
|
properties: {
|
|
prefixCls: {
|
|
type: String,
|
|
value: 'wux-skeleton-paragraph',
|
|
},
|
|
rows: {
|
|
type: Number,
|
|
value: 3,
|
|
},
|
|
rounded: {
|
|
type: Boolean,
|
|
value: false,
|
|
},
|
|
},
|
|
data: {
|
|
active: false,
|
|
rowList: [],
|
|
},
|
|
computed: {
|
|
classes: ['prefixCls, active, rounded', function(prefixCls, active, rounded) {
|
|
const wrap = classNames(prefixCls, {
|
|
[`${prefixCls}--active`]: active,
|
|
[`${prefixCls}--rounded`]: rounded,
|
|
})
|
|
const row = `${prefixCls}__row`
|
|
|
|
return {
|
|
wrap,
|
|
row,
|
|
}
|
|
}],
|
|
},
|
|
methods: {
|
|
updated(active) {
|
|
if (this.data.active !== active) {
|
|
this.setData({
|
|
active,
|
|
})
|
|
}
|
|
},
|
|
updateRows(rows = this.data.rows) {
|
|
this.setData({
|
|
rowList: [...Array(rows)].map((_, index) => index),
|
|
})
|
|
},
|
|
},
|
|
attached() {
|
|
this.updateRows()
|
|
},
|
|
})
|
|
|