<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <!--本地 icon 资源, uniapp 打包到 app 仅支持标签 image, 打包小程序和 H5 均可支持标签 img -->
  <div class="icon">
    <image
      v-if="isApp"
      class="icon"
      :src="props.file"
      :style="{ width: props.width, height: props.height }"
    />
    <img
      v-else
      class="icon"
      :src="props.file"
      :style="{ width: props.width, height: props.height }"
    >
  </div>
</template>
<script lang="ts">
import { isApp } from '../../utils/env';
export default {
  props: {
    file: {
      type: String,
      default: '',
    },
    width: {
      type: String,
      default: '20px',
    },
    height: {
      type: String,
      default: '20px',
    },
  },
  setup(props) {
    return {
      props,
      isApp,
    };
  },
};
</script>
<style lang="scss" scoped>
.icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
}
</style>
