How to add dynamic current year in Vue JS

Use Vue.js dynamic current year. without any npm plugin and jquery.

Step 1: Components

<template>
    <div class="copyright-area">
        <p>CopyRight - {{currentYear}}</p>
    </div>
</template>

Step 2: JS

<script>
export default {
    data() {
        return {
            currentYear: new Date().getFullYear(),
        };
    },
}
</script>

 


Posted

in

, , ,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *