2025-03-14 17:52:05 +08:00

45 lines
902 B
Vue

<template>
<el-select-v2 v-model="val" :options="options" placeholder="请选择网格" :props="_props" @change="handleSelect" />
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { GetEntityList } from '@/apis/grid.js';
const emit = defineEmits(['update:value']);
const props = defineProps({
// 父组件传过来的值
value: {
type: String || null,
default: null,
},
});
onMounted(async () => {
let res = await GetEntityList();
if (res.code == 200) {
options.value = res.data.records;
}
});
/* --------------- data --------------- */
// #region
const val = ref(null);
const options = ref([]);
const _props = {
value: 'id',
label: 'productName',
};
// #endregion
/* --------------- methods --------------- */
// #region
function handleSelect(val_) {
emit('update:value', val_);
}
// #endregion
</script>
<style lang="scss" scoped></style>