| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <template>
- <view class="image-wrap" :style="{width: torpx + 'px', height: torpx + 'px'}" >
- <image v-if="src" :src="src" mode="aspectFit"></image>
- </view>
- </template>
- <script>
- export default {
- name:"c-icon",
- data() {
- return {
-
- };
- },
- props: {
- src: {
- type: String,
- default: ''
- },
- size: {
- type: Number | String,
- default: 40
- }
- },
- computed:{
- torpx(){
- return uni.upx2px(this.size)
- }
- }
- }
- </script>
- <style lang="scss">
- .image-wrap{
- display: inline-flex;
- align-items: center;
- font-size: 0;
- image{
- width: 100%;
- height: 100%;
- }
- }
- </style>
|