zhouwx
2024-07-17 246f7b6fd81cf2ba620b8f9bf7cf24b61d7cf521
src/components/scrollSelect/index.vue
@@ -1,7 +1,7 @@
<template>
  <el-select v-if="isMounted" v-bind="$attrs" :remote-method="remoteMethod" @change="selectValueUser">
    <div v-infinite-scroll="loadMore" style="overflow: hidden">
      <el-option v-for="dict in list" :key="dict.id" :label="dict.name" :value="dict.name" />
      <el-option v-for="dict in list" :key="dict.id" :label="dict.username" :value="dict.username" />
    </div>
  </el-select>
</template>
@@ -27,7 +27,7 @@
const list = ref([
  {
    id: '',
    name: '无上级账号'
    username: '无上级账号'
  }
])
const queryFrom = ref({
@@ -46,7 +46,7 @@
const emit = defineEmits(["getval"]);
const selectValueUser = (val) => {
  list.value.forEach(item => {
    if(item.name === val){
    if(item.username === val){
      emit('getval',item.id)
    }
  })
@@ -69,7 +69,7 @@
    props.methods(queryFrom.value).then(res => {
      const obj = {
        id: '',
        name: '无上级账号'
        username: '无上级账号'
      }
      if(type === 'change'){
        list.value = res.data.list