uni-id-pages-x-icons.uvue 915 字节
Newer Older
DCloud_JSON's avatar
init  
DCloud_JSON 已提交
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
<template>
	<view>
		<text class="uni-id-icon" :style="{color,'fontSize':size + 'px'}">{{iconCode}}</text>
	</view>
</template>

<script>
	export default {
		props: {
			type: {
				type: String,
				default: "",
				required: true
			},
			color: {
				type: String,
				default: "#ccc"
			},
			size: {
				type: Number,
				default: 16
			},
		},
		computed: {
			iconCode() : string {
				const iconCode : UTSJSONObject = {
					"clear": "\ue622",
					"down": "\ue600",
					"right-arrow": "\ue8f1",
					"jiahao": "\ue602",
					"eyes": "\ue62b",
					"advert": "\ue609"
				};
				return iconCode.getString(this.type) as string
			}
		},
		data() {
			return {}
		}
	}
</script>

<style>
	@font-face {
		font-family: "uni-id-icon";
    src: url('/uni_modules/uni-id-pages-x/static/fonts/uni-id-icon.ttf');
	}

	.uni-id-icon {
		font-family: "uni-id-icon";
		font-size: 16px;
		font-style: normal;
	}
</style>