useAttrs
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
b30da92c1d
commit
bfab1ec314
|
@ -1,7 +1,6 @@
|
|||
<script setup>
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { ref, onBeforeMount, useAttrs } from 'vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const $props = defineProps({
|
||||
row: {
|
||||
|
@ -12,19 +11,15 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
const options = ref([]);
|
||||
onBeforeMount(async () => {
|
||||
const findBy =
|
||||
$props.find ?? $props.url.charAt(0).toLocaleLowerCase() + $props.url.slice(1, -1);
|
||||
options.value = [$props.row[findBy]];
|
||||
const { url } = useAttrs();
|
||||
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||
if (findBy) options.value = [$props.row[findBy]];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" :url="url" />
|
||||
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue