| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <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>
|