You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
|
2 years ago
|
<!--
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2023-07-20 13:49:22
|
||
|
|
@ 备注:
|
||
|
|
-->
|
||
|
|
<script lang='ts' setup>
|
||
|
|
import { computed, onMounted, nextTick } from 'vue'
|
||
|
|
const props = withDefaults(
|
||
|
|
defineProps<{
|
||
|
|
modelValue?: string
|
||
|
|
disabled?: boolean
|
||
|
|
}>(),
|
||
|
|
{}
|
||
|
|
)
|
||
|
|
const emits = defineEmits<{
|
||
|
|
(e: 'update:modelValue', value: string): void
|
||
|
|
}>()
|
||
|
|
const userDialogEl = ref()
|
||
|
|
// const value:any = computed({
|
||
|
|
// get() {
|
||
|
|
// return props.modelValue
|
||
|
|
// },
|
||
|
|
// set(newVal: string) {
|
||
|
|
// emits('update:modelValue', newVal)
|
||
|
|
// }
|
||
|
|
// })
|
||
|
|
const value = computed({
|
||
|
|
get: () => props.modelValue,
|
||
|
|
set: (newVal: any) => {
|
||
|
|
emits('update:modelValue', newVal)
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
const openDialog = () => {
|
||
|
|
userDialogEl.value.open()
|
||
|
|
}
|
||
|
|
onMounted(() => {
|
||
|
|
nextTick(() => {})
|
||
|
|
})
|
||
|
|
</script>
|
||
|
|
<template>
|
||
|
|
<el-input
|
||
|
|
placeholder="请选择用户或输入用户名称"
|
||
|
|
v-bind="$props"
|
||
|
|
v-model="value"
|
||
|
|
@click="openDialog"
|
||
|
|
>
|
||
|
|
<template #append>
|
||
|
|
<i class="icon-user" @click.stop="openDialog"></i>
|
||
|
|
</template>
|
||
|
|
</el-input>
|
||
|
|
<user-dialog ref="userDialogEl" v-model="value" />
|
||
|
|
</template>
|
||
|
|
<style lang='scss' scoped>
|
||
|
|
|
||
|
|
</style>
|