Reusable methods that can be use in any pages
How to make reusable methods and that can be used in any pages. Please make it for the most best practice of it.
utils/utils/utils/utils/utils/utils/myMethods.ts// utils/myMethods.ts
export function useSum(a: number, b: number) {
return a + b
}
export function formatDate(date: Date) {
// Your date formatting logic here
}
// Add more methods as needed<script setup>
const result = useSum(5, 3)
const formattedDate = formatDate(new Date())
</script>
<template>
<div>
<p>Sum: {{ result }}</p>
<p>Date: {{ formattedDate }}</p>
</div>
</template>