feat(components): 新增字典选择器和卡片组件
This commit is contained in:
parent
9719cdf579
commit
a7c3eae535
43
components/DictSelect/DictSelect.vue
Normal file
43
components/DictSelect/DictSelect.vue
Normal 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
23
components/MBCard.vue
Normal 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>
|
||||||
Loading…
x
Reference in New Issue
Block a user