Files
cdTestPlant3/cdTMP/src/components/ma-userInfo/index.vue

38 lines
742 B
Vue
Raw Normal View History

2023-06-08 21:09:28 +08:00
<!--
2024-09-06 10:48:22 +08:00
- @Author XXX
- @Link XXX
2023-06-08 21:09:28 +08:00
-->
<template>
2024-09-06 10:48:22 +08:00
<a-input v-model="val" :label="props.title" disabled class="w-full" />
2023-06-08 21:09:28 +08:00
</template>
<script setup>
2024-09-06 10:48:22 +08:00
import { ref, watch } from 'vue'
import { useUserStore } from '@/store'
2023-06-08 21:09:28 +08:00
const user = useUserStore().user
const val = ref()
2024-09-06 10:48:22 +08:00
const emit = defineEmits(['update:modelValue'])
2023-06-08 21:09:28 +08:00
const props = defineProps({
2024-09-06 10:48:22 +08:00
modelValue: [ String, Number ],
title: { type: String, default: '用户信息'},
field: { type: String, default: 'id'},
2023-06-08 21:09:28 +08:00
})
val.value = user[props.field] ? user[props.field].toString() : user.id.toString()
watch(
2024-09-06 10:48:22 +08:00
() => val.value,
vl => emit('update:modelValue', vl),
{ immediate: true }
2023-06-08 21:09:28 +08:00
)
2024-09-06 10:48:22 +08:00
2023-06-08 21:09:28 +08:00
</script>
<style scoped>
:deep(.arco-select-option-content) {
2024-09-06 10:48:22 +08:00
width: 100%;
2023-06-08 21:09:28 +08:00
}
</style>