123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <i class="icon" :class="[name]" :style="[fontStyle]"></i>
- </template>
- <script>
- export default {
- props: {
- name: String,
- // 字体大小
- size: {
- type: [Number, String],
- default: ''
- },
- color: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- // fontStyle:{}
- }
- },
- onLoad() {
- // if (this.size) this.fontStyle.fontSize = this.size + uni.$u.config.unit
- // if (this.color) this.fontStyle.color = this.color
- },
- computed: {
- fontStyle() {
- const style = {}
- if (this.size) style.fontSize = this.size + uni.$u.config.unit
- if (this.color) style.color = this.color
- return style
- },
- },
- beforeCreate() {
- },
- methods: {
- onClick() {
- this.$emit('click')
- }
- },
- }
- </script>
- <style scoped>
- </style>
|