Working with Methods in the Vue Framework
In Vue, you can create your own functions, which in Vue terms are called methods. The methods property is intended for this. It is located as follows:
export default {
data() {
},
methods: {
}
}
For the sake of brevity, I will write further in abbreviated form, like this:
methods: {
}
Let's make some test method:
methods: {
show: function() {
alert('!');
}
}
Let's call this method in the view. In this case, it will work immediately after the page loads:
<template>
{{ show() }}
</template>
Make a method that will output the current date after alert.