0.0.6 • Published 1 year ago
@tamnt-work/nuxt3-layer v0.0.6
Nuxt3 Layers
Nuxt 3 base layer for normal projects
Required
yarn add -D @nuxt/image-edge @nuxtjs/html-validator @vueuse/nuxt sass
yarn add nuxt-windicss
Installation
Install nuxt3-layer with npm
npm install -D @tamnt-work/nuxt3-layer
Install nuxt3-layer with yarn
yarn add -D @tamnt-work/nuxt3-layer
Usage
Add to nuxt.config.ts:
export default defineNuxtConfig({
extends: ["@tamnt-work/nuxt3-layer"],
});
Feature
- HTML validator
- Vue use
- Windicss
- Nuxt image
- Sass
- Element Plus UI
- Pinia
- Auto import composables, constants, utils
Use useFetch with base url + auto add access token to headers
Add url api to .env at root
BASE_URL_API=https://jsonplaceholder.typicode.com
To automatically attach the access_token a to the header, set the value to the cookie with name access_token
const cookie = useCookie("access_token");
cookie.value = "value";
To call api with base url + access_token use composable useApi
const { data, refresh } = await useApi<
Array<{
userId: number;
id: number;
title: string;
body: string;
}>
>("/posts");
Support
For support, email contact@tamnt.work.