csrq
v0.0.2
Published
CheShine ReQuset is a library to handle network request.
Downloads
3
Readme
csrq
Description
CheShine ReQuset is a library to handle network request for Vue.
Support for axios and fetch (will).
usage
Install csrq as:
npm install csrq --save
You can use it as:
import { createApp } from "vue";
import App from "./App.vue";
import { requestPlugin } from "csrq";
createApp(App).use(requestPlugin, {}).mount("#app");
and then you can have it in components by hooks:
<script setup lang="ts">
import { useRequest } from "csrq";
import { onMounted } from "vue";
onMounted(() => {
const req = useRequest();
const url = "api/1";
const params = { param1: "value1", param2: "value2" };
const api1 = req.createGetRequestExecutor(url, params);
console.log(api1);
});
</script>