deguodaigou/utils/dist/icon/index.js
2019-12-23 14:13:27 +08:00

40 lines
913 B
JavaScript

import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
VantComponent({
props: {
dot: Boolean,
info: null,
size: {
type: null,
observer: 'setSizeWithUnit'
},
color: String,
customStyle: String,
classPrefix: {
type: String,
value: 'van-icon'
},
name: {
type: String,
observer(val) {
this.setData({
isImageName: val.indexOf('/') !== -1
});
}
}
},
data: {
sizeWithUnit: null,
},
methods: {
onClick() {
this.$emit('click');
},
setSizeWithUnit(size) {
this.setData({
sizeWithUnit: addUnit(size)
});
}
}
});