image-format.uvue 1.2 KB
Newer Older
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
<template>
	<view>
		<page-head :title="title"></page-head>
		<view class="uni-padding-wrap uni-common-mt">
			<view class="uni-title">
				<text class="uni-title-text">支持的图片格式示例</text>
			</view>
			<view v-for="(item,index) in data" :key="index">
				<text class="uni-subtitle-text">{{item.format}}</text>
				<view class="uni-center" style="background:#FFFFFF;">
					<image class="image" mode="widthFix" :src="item.src"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'image-format',
				data: [{
						format: 'png',
						src: '/static/logo.png'
					},
					{
						format: 'jpg',
						src: '/static/logo.jpg'
					},
					{
						format: 'webp',
						src: '/static/logo.webp'
					},
					{
						format: 'bmp',
						src: '/static/logo.bmp'
					},
					{
						format: 'gif',
						src: '/static/logo.gif'
					}
				] as Array < ImageFormat >
			}
		}
	}

	class ImageFormat {
		format: string;
		src: string;

		constructor(format: string, src: string) {
			this.format = format;
			this.src = src;
		}
	}
</script>

<style>
	.image {
		margin: 40rpx auto;
		width: 200rpx;
	}
</style>