Skip to content

Simple Vue3 plugin connect api and strapi. Power by axios.

Notifications You must be signed in to change notification settings

seapp88/vue3-plugin-api-strapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue3-plugin-api-strapi

Simple Vue3 plugin connect api and strapi. Power by axios.


Install

npm install vue3-plugin-api-strapi --save

or

yarn add vue3-plugin-api-strapi

edit file src/main.js

import api from 'vue3-plugin-api-strapi'

const app = createApp(App);

app.use(api, {
    defaults: {
        baseURL: 'http://localhost:1337'
    },
    models: ['users']
})

app.mount('#app')

Get started

Vue options api

this.$axios //axios instance
this.$api // new axios instance api set BaseUrl in options by plugin
this.$models[model_name] // Strapi endpoins ['find', 'findone', 'count', 'create', 'update', 'delete']

Vue composition api

<template>
    ...
</template>

<script>
import { useApi } from 'vue3-plugin-api-strapi'

export default{
    setup(){
        const { axios, api, models } = useApi()
    }
}
</script>

About

Simple Vue3 plugin connect api and strapi. Power by axios.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published