<template>
	<uni-tag :text='text' :type='type' :disabled='disabled' :inverted='inverted' :circle='circle' :size='size'
		@click="bindClick"></uni-tag>
</template>

<script>
	import {
		onReachBottom
	} from '@dcloudio/uni-app'
	import {
		ref,
		toRefs,
		defineProps,
		defineComponent,
		computed,
		onMounted,
		reactive
	} from 'vue'
	import {
		useSetDictStore
	} from '@/stores/useSetDictStore';
	export default defineComponent({
		name: 'DictTag',
		props: {
			dictType: {
			  type: String,
			  required: true
			},
			value: {
				type: String,
				required: true
			},
			type: {
				type: String,
				default: 'primary',
				required: false
			},
			disabled: {
				type: Boolean,
				default: false,
				required: false
			},
			inverted: {
				type: Boolean,
				default: true,
				required: false
			},
			circle: {
				type: Boolean,
				default: false,
				required: false
			},
			size: {
				type: String,
				default: 'normal',
				required: false
			}
		},
		setup(props) {
			const {
				value,
				type,
				disabled,
				inverted,
				circle,
				size
			} = props
			const attrs = reactive({
				...props,
				text: '',
			})
			const store = useSetDictStore();

			onMounted(() => {
				if(store.dicts?.length > 0) {
					for (let x = 0; x < store.dicts.length; x++) {
						const { dictType, value, colorType, label } = store.dicts[x]
						if (dictType === props.dictType && value * 1 === props.value) {
							
						}
						console.log(store.dicts[x]);
					}
				}
				console.log(props.dictType, store.dicts?.length);
			})

			return {
				value,
				type,
				disabled,
				inverted,
				circle,
				size,
				...toRefs(attrs)
			}
		}
	})
</script>


<style>
</style>