feat(components): 新增字典选择器和卡片组件

This commit is contained in:
lonewolfyx 2026-02-05 15:56:33 +08:00
parent 9719cdf579
commit a7c3eae535
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<template>
<uni-data-select
v-model="modelValue"
:localdata="options"
v-bind="omit($attrs,['change'])"
/>
</template>
<script setup>
import {defineModel, defineOptions, defineProps, getCurrentInstance, ref, watch} from 'vue'
import {omit} from "radash";
import {getDicts} from "../../api/system/dict/data";
import UniDataSelect from "../../uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue";
defineOptions({
name: 'DictSelect',
inheritAttrs: false
})
const modelValue = defineModel()
const props = defineProps(['dict'])
const {proxy} = getCurrentInstance()
const options = ref([])
watch(() => props.dict, async () => {
if (!props.dict) return ''
const {data} = await getDicts(`${props.dict}`)
options.value = data.map(item => {
return {
value: item.dictValue,
text: item.dictLabel
}
})
}, {
immediate: true
})
</script>
<style lang="scss" scoped>
</style>

23
components/MBCard.vue Normal file
View File

@ -0,0 +1,23 @@
<template>
<view class="mb-card">
<slot/>
</view>
</template>
<script setup>
import {defineOptions} from 'vue'
defineOptions({
name: 'MBCard'
})
</script>
<style lang="scss" scoped>
.mb-card {
background: #FFFFFF;
padding: 10px;
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
margin-bottom: 15px;
}
</style>