Application Vue 3 + TypeScript pour la gestion des rappels de mobilité.
This template should help get you started developing with Vue 3 in Vite.
- Vue 3 - Framework JavaScript progressif
- TypeScript - Superset typé de JavaScript
- Vite - Build tool et serveur de développement
- Pinia - Store management officiel pour Vue 3
- Vue Router - Routage côté client
- Vitest - Framework de test unitaire
Ce projet utilise Pinia comme solution de gestion d'état. Pinia est le store officiel pour Vue 3 qui remplace Vuex.
Pinia est configuré dans src/main.ts :
import { createPinia } from 'pinia'
app.use(createPinia())Store d'exemple utilisant la Composition API :
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, doubleCount, increment }
})Pour utiliser un store dans un composant :
<script setup>
import { useCounterStore } from '@/stores/counter'
const store = useCounterStore()
</script>
<template>
<div>
<p>Count: {{ store.count }}</p>
<button @click="store.increment()">Increment</button>
</div>
</template>Voir src/views/HomeView.vue pour un exemple concret d'utilisation du store Pinia dans un composant.
VSCode + Volar (and disable Vetur).
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need Volar to make the TypeScript language service aware of .vue types.
See Vite Configuration Reference.
npm installnpm i @capacitor/core
npm i -D @capacitor/cli
npx cap init
npm i @capacitor/android @capacitor/ios
npx cap add android
npx cap add ios
npm install @capacitor/local-notifications
npm run build
npx cap sync# Build the Vue app
npm run build
# Copy web assets to native platforms and sync plugins
npx cap sync
# Run the native app on Android or iOS
npx cap run android # or iosnpm run devnpm run buildRun Unit Tests with Vitest
npm run test:unitLint with ESLint
Handle lint in eslint.config.ts
# To check files with lint rules
npm run lint
# To fix files with lint rules
npm run lint -- --fix# This package allow you to create assets easily, but it's better have real assets with every sizes
# Install the package that will generate all sizes needed
npm install @capacitor/assets --save-dev
# Create a resources folder and add an image inside and then generate all images needed
npx capacitor-assets generateSee Capacitor See Notifications