<!-- <template>
	<div class="test">
		<div class="item" v-for="item in data" :key="item.id">
			<slot>
				{{ item.name }}
			</slot>
		</div>
	</div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { onMounted, ref, computed } from 'vue'

const props = defineProps<{
	url: string;
	data?: object;
	params?: object;
	request?(): any;
}>();

const request = computed(() => props.request ? props.request : () => axios({
        method: 'post',
        url: props.url,
        data: props.data,
        params: props.params
    }))

const data = ref([])

const requestData = async () => {
   const { result } = await request.value();
    data.value = result;

}

onMounted(() => {
   requestData();
}),
</script>

<style scoped lang="less"></style> -->
