⊗jsvuPmBsMt 9 of 72 menu

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.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline