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.
47 lines
1.0 KiB
47 lines
1.0 KiB
Component({
|
|
externalClasses: ['wux-class'],
|
|
properties: {
|
|
type: {
|
|
type: String,
|
|
value: '',
|
|
},
|
|
size: {
|
|
type: [String, Number],
|
|
value: 32,
|
|
observer: 'updated',
|
|
},
|
|
color: {
|
|
type: String,
|
|
value: '',
|
|
},
|
|
hidden: {
|
|
type: Boolean,
|
|
value: false,
|
|
},
|
|
},
|
|
data: {
|
|
fontSize: '',
|
|
},
|
|
methods: {
|
|
updated(size = this.data.size) {
|
|
let fontSize = size
|
|
|
|
if (typeof size === 'number') {
|
|
fontSize = `${size}px`
|
|
} else if (typeof size === 'string') {
|
|
if (!isNaN(Number(size))) {
|
|
fontSize = `${size}px`
|
|
}
|
|
}
|
|
|
|
if (this.data.fontSize !== fontSize) {
|
|
this.setData({
|
|
fontSize,
|
|
})
|
|
}
|
|
},
|
|
},
|
|
attached() {
|
|
this.updated()
|
|
},
|
|
})
|
|
|