| 123456789101112131415161718192021222324252627282930313233343536 |
- <template>
- <image class="u-icon-img" :src="resolvedSrc" :style="{ width: (size??0) + 'px', height: (size??0) + 'px' }"
- mode="aspectFit" @click="handleClick" />
- </template>
- <script lang="uts">
- export default {
- props: {
- name: String,
- src: String,
- size: Number,
- active: Boolean
- },
- computed: {
- resolvedSrc() : string {
- if (this.src != null) return this.src;
- if (this.name != null) {
- const key = (this.active == true ? `${this.name}-active` : this.name) as string;
- return `/static/icons/${key}.svg`;
- }
- return '';
- }
- },
- methods: {
- handleClick() {
- this.$emit('click');
- }
- }
- };
- </script>
- <style>
- .u-icon-img {
- /* display: block; */
- }
- </style>
|